表:table_name 的字段:aa 的赋值给 DropDownList1,结果出错显示1 5 或者 1 0 这样的数字?
DataSet ds1 = new DataSet();
da.Fill(ds1, "table_name");
this.DropDownList1.DataSource = ds1.Tables ["table_nale"].Rows[1][1].ToString() ;
this.DropDownList1.DataBind();
DataSet ds1 = new DataSet();
da.Fill(ds1, "table_name");
this.DropDownList1.DataSource = ds1.Tables ["table_nale"].Rows[1][1].ToString() ;
this.DropDownList1.DataBind();
解决方案 »
- 关于数据嵌套显示的问题?
- dll反编译成mdb
- 字符串截取【基础题】
- 动态生成的下拉列表怎样添加事件
- 如何实现查找两层数结构中子节点中的文本?
- 如何连接加密的ACCESS数据库
- 去掉标题栏后怎么才能正常显示系统菜单---急急在线等
- %%%%%%%%%%%%%50分快来人啊,简单的问题,循环输出几行数据%%%%%%%%%%%%
- 请问当我在登陆页面中输入用户名和密码全是'or'='or'时就可能登陆到我的邮件系统中,怎么才能用代码的形式来防止这种情况的发生呀?希望给个这方面的例子。谢谢
- 有谁知道。net的开发环境中属性窗口中显示属性的控件是用什么控件做的
- 有个关于SQL的简单问题
- 【高分求解】dataGridView如何分页?如何实现增删改然后保存在SQL数据库?
这句有问题,这个地方要用 ds1.Tables ["table_nale"]
如果想赋单个值可以这样写
DropDownList1.Item.Add(ds1.Tables ["table_nale"].Rows[1][1].ToString());
然后,可以根据你赋值的Item来设置他的Text和value
this.DropDownList1.DataSource = ds1.Tables ["table_nale"] ; this.DropDownList1.DataBind();
da.Fill(ds1, "table_name");
this.DropDownList1.DataSource = ds1.Tables ["table_nale"];
this.DropDownList1.DataTextField = "aa";
this.DropDownList1.DataValueField = "aa";
this.DropDownList1.DataBind();
DataSet ds1 = new DataSet();
da.Fill(ds1, "table_name");
this.DropDownList1.DataSource = ds1.Tables ["table_nale"];
this.DropDownList1.DataTextField = "aa";
this.DropDownList1.DataValueField = "aa";
this.DropDownList1.DataBind();
da.Fill(ds1, "table_name");
this.DropDownList1.DataSource = ds1.Tables ["table_name"];
this.DropDownList1.DataTextField = "aa";
this.DropDownList1.DataValueField = "aa";
this.DropDownList1.DataBind();按照如下代码:提示错误:databingding "system.data.datarowviw"不包含名为:"aa"的属性????
this.DropDownList1.DataSource = ds1.Tables ["t2"];
this.DropDownList1.DataTextField = "t2_aa";
this.DropDownList1.DataValueField = "t2_aa";
this.DropDownList1.DataBind();
select a as b from tale