网站单个产品计数器实现

 

public partial class cn_Product_Product_more : System.Web.UI.Page
{
    public string tppath;
    HKMS.SQLHelper g_Help = new HKMS.SQLHelper();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Request.QueryString["ID"] != null)
            {
                string l_sql = "select * from CN_PRODUCT where P_ID=" + Request.QueryString["ID"];
                loader(l_sql);
                jjsq();
            }
        }
    }

    //=============================================
    //函数名称:loaderData()
    //作    用:将查询到的内容绑定到控件上
    //=============================================
    private void loader(string l_str)
    {
        DataTable dt = new DataTable();
        g_Help.FillDataTable(ref dt, l_str);
        if (dt.Rows.Count > 0)
        {
            tppath = dt.Rows[0].ItemArray.GetValue(3).ToString();
            name.Text = dt.Rows[0].ItemArray.GetValue(1).ToString();
            price.Text = dt.Rows[0].ItemArray.GetValue(5).ToString();
            nianfen.Text = dt.Rows[0].ItemArray.GetValue(6).ToString();
            shu.Text = dt.Rows[0].ItemArray.GetValue(7).ToString();
            contacter.Text = dt.Rows[0].ItemArray.GetValue(8).ToString();
            tel.Text = dt.Rows[0].ItemArray.GetValue(9).ToString();
            qita.Text = dt.Rows[0].ItemArray.GetValue(10).ToString();
            source.Text = dt.Rows[0].ItemArray.GetValue(11).ToString();
            xx.Text = dt.Rows[0].ItemArray.GetValue(2).ToString();
        }
    }
    protected void jjsq()
    {
        string str = "Update CN_PRODUCT set [Count]=CStr(CInt([Count])+1) where P_ID=" + Request.QueryString["ID"];
        g_Help.UpdateDate(str);
    }
}

你可能感兴趣的:(产品)