⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ucprolist.ascx.cs

📁 基于VS05和SQL05做的一个电子商务网站
💻 CS
字号:
using System;
using System.Data;
using System.Data.SqlClient;
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;

public partial class ucProList : System.Web.UI.UserControl
{
    public string _strint="最新商品";
    public string strint {
        set { _strint = value; }
        get { return _strint; }
    }
    public int _ProType = 1;
    public int ProType {
        set { _ProType = value; }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack) BindRepeater();
    }
    private void BindRepeater()
    {
        SqlConnection myConnection = new SqlConnection(ConfigurationManager.AppSettings["ConnStr"]); 
        string cmdString = "select top 5 * from Products where ProductType in (select category_ID from PType where parentID=" + _ProType + ")";
        SqlCommand myCommand = new SqlCommand(cmdString, myConnection);
        myConnection.Open();
        SqlDataReader myReader = myCommand.ExecuteReader();
        Repeater1.DataSource = myReader;
        Repeater1.DataBind();
        myReader.Close();
        myConnection.Close();
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -