日期:2014-05-18 浏览次数:20679 次
//初始分组 string resultstr = "select category from dbo.XN_Category";//定义SQL语句 SqlConnection conn = App_Code.BaseClass.DBCon();//连接DB conn.Open();//打开DB SqlCommand cmd = new SqlCommand(resultstr, conn); SqlDataReader sdr = cmd.ExecuteReader(); sdr.Read(); DropDownList1.DataTextField = "category"; DropDownList1.DataSource = sdr; DropDownList1.DataBind(); conn.Close();