DropDownList绑定的问题 我要修改数据,在DropDownList显示该修改数据一个分类,这个要怎么绑定? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 DropDownList1.DataSource = datatable;DropDownList1.DataTextField = "classname";DropDownList1.DataValueField = "classid";DropDownList1.DataBind(); string strSQL = "select * from zclx where lb='1'";SqlDataReader dr = GetData.GetReadbySQL(strSQL);ddlZclx.DataSource = dr;ddlZclx.DataTextField = "mc";ddlZclx.DataValueField = "lb";ddlZclx.DataBind(); 我对ADO.NET的一点都不懂,这个(SqlDataReader dr = GetData.GetReadbySQL(strSQL);)是做什么的?private void Departments_List_bind() { string strSQL = "select * from Departments where Id=" + Request.QueryString["Id"].ToString() + " "; SqlDataReader dr = GetData.GetReadbySQL(strSQL); Departments_List.DataSource = dr; Departments_List.DataTextField = "Classname"; Departments_List.DataValueField = "Id"; Departments_List.DataBind(); }我这样写可以吗? string strSQL = "select * from zclx where lb='1'"; SqlDataReader dr = GetData.GetReadbySQL(strSQL); ddlZclx.DataSource = dr; ddlZclx.DataTextField = "mc"; ddlZclx.DataValueField = "lb"; ddlZclx.DataBind(); private void Departments_List_bind() { string strSQL = "select * from Departments where Id=" + Request.QueryString["Classid"].ToString() + " "; DataTable dt = DacTools.GetDataSet(strSQL); Departments_List.DataSource = dt; Departments_List.DataTextField = dt.Rows[0]["Classname"].ToString(); Departments_List.DataValueField = dt.Rows[0]["Id"].ToString(); Departments_List.DataBind(); }之前定义了一个类DacTools的Departments_List是DropDownList,这样好象显示不出来 参考http://www.cnblogs.com/torome/articles/300556.html 关于Exception.StackTrace详细错误信息的问题 TreeNode怎么设置文字的颜色,急求 读取远程地址的xml,如何缓存速度才能更快! 简单的问题 在asp.net1.1中,如何对访问某一html页面时进行身份验证? 如何访问到自动生成的静态页面 求救!求一个分页存储过程! 静态页显示动态的数据?这个静态页有个“下载次数”要经常更新如何做 怎么在当前日期上面减去一天,得到前一天的日期 请教大侠,调试时设置的断点,可没中断在线等待谢谢!! C#查看远程网页代码问题,请求帮助!!! 如何实现上传图片并在页面中的image控件中显示
DropDownList1.DataTextField = "classname";
DropDownList1.DataValueField = "classid";
DropDownList1.DataBind();
SqlDataReader dr = GetData.GetReadbySQL(strSQL);
ddlZclx.DataSource = dr;
ddlZclx.DataTextField = "mc";
ddlZclx.DataValueField = "lb";
ddlZclx.DataBind();
是做什么的?
private void Departments_List_bind()
{
string strSQL = "select * from Departments where Id=" + Request.QueryString["Id"].ToString() + " ";
SqlDataReader dr = GetData.GetReadbySQL(strSQL);
Departments_List.DataSource = dr;
Departments_List.DataTextField = "Classname";
Departments_List.DataValueField = "Id";
Departments_List.DataBind();
}
我这样写可以吗?
SqlDataReader dr = GetData.GetReadbySQL(strSQL);
ddlZclx.DataSource = dr;
ddlZclx.DataTextField = "mc";
ddlZclx.DataValueField = "lb";
ddlZclx.DataBind();
{
string strSQL = "select * from Departments where Id=" + Request.QueryString["Classid"].ToString() + " ";
DataTable dt = DacTools.GetDataSet(strSQL);
Departments_List.DataSource = dt;
Departments_List.DataTextField = dt.Rows[0]["Classname"].ToString();
Departments_List.DataValueField = dt.Rows[0]["Id"].ToString();
Departments_List.DataBind();
}
之前定义了一个类DacTools的
Departments_List是DropDownList,这样好象显示不出来
http://www.cnblogs.com/torome/articles/300556.html