using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

public partial class WebMain_Product_Indexproduct_smaillID_pID : System.Web.UI.UserControl
{
    private string idd;
    private int count1;
    private int columns;


    public string PSid
    {
        set { idd = value.ToString(); }
    }
    public string PCount
    {
        set { count1 =int.Parse(value.ToString()); }
    }
    public string Pcolumns
    {
        set { columns =int.Parse(value.ToString()); }
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        this.databind();
    }
    public void databind()
    {
        int count = count1;//此处设置个数
        SqlConnection conn = CDatabase.wtoconn();
        conn.Open();
        SqlCommand smd = new SqlCommand("select top " + count + " * from ProductInfo where IsNew='y' and ISPublished='y' and BigProductID=" + idd + " order by AddDate desc", conn);
        SqlDataReader sdr = smd.ExecuteReader();
        if (sdr.HasRows)
        {
            this.isnew.DataSource = sdr;
            this.isnew.DataBind();
            this.isnew.RepeatColumns = columns;

        }
        else
        {
            Label l1 = new Label();
            l1.Text = "暂无数据";
        }     
        sdr.Close();
        conn.Close();
    }
  
}
