如下面的sql语句,我从数据库中取出两列数据,要将这两列中的一列绑定到DropDownList控件,应该怎么写DropDownList1.DataSource? 才能只将thename这个列绑定到DropDownList控件.
string sql="select thename,pwd from users";
myOleCom.Fill(myds,"users");
DropDownList1.DataSource=myds.Tables["users"];//这一行该怎么写??
DropDownList1.DataBind();谢谢~~
string sql="select thename,pwd from users";
myOleCom.Fill(myds,"users");
DropDownList1.DataSource=myds.Tables["users"];//这一行该怎么写??
DropDownList1.DataBind();谢谢~~
解决方案 »
- mvc3中location.href传值怎么接收不到啊
- 怎么才能刷新页面时不刷新页面上的用户控件?
- 问个问题和求个工具
- silverlight tools beta 2 for vs 2008 安装问题
- |M| 看了VS2005功能很是强大 在这里求些有2005Theme主题的下载地址 谢谢-------
- 有个小问题
- “_ASP.WebUserControl1_ascx”内不允许包含文字内容(“ssssssss”)。
- 没有安装所需组件?
- 妹妹急呀--请各位大哥帮帮忙 (ADO NET 高手请进)
- 我用CompareValidator控件检验 2003-4-14 8:43:49 时报错误,我应该用什么方法校验?
- GridView弹对话框 问题 在线等
- 做ASP.NET开发的有想换工作的请进!
this.DropDownList1.DataTextField="thename";
DropDownList1.DataBind();
DropDownList1.DataTextField=你要绑定的字段