数据绑定求教 myCommand.Fill(ds, "States");改成myCommand.Fill(ds, "Authors");第二个参数是你查询出来的表名 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 谢谢你这么快的回复,但是这个我肯定试过,还是不行// SqlConnection myConnection = new SqlConnection("User ID=sa;Initial Catalog=pubs ;Data Source=(local);PassWord=");// SqlCommand myCommand = new SqlCommand("select distinct State from Authors", myConnection);// ArrayList a = new ArrayList();//// myConnection.Open();//// SqlDataReader dr = myCommand.ExecuteReader();//// while(dr.Read())// {// a.Add(dr.GetSqlString(0));// }// // dr.Close();// myConnection.Close();//// DropDownList1.DataSource = a;// DropDownList1.DataBind();只好这么搞定,但是我很想知道是不是数据绑定会有很多问题???? DropDownList1.DataSource= ds.Tables["States"].DefaultView;DropDownList1.DataTextField=字段名DropDownList1.DataValueField=字段名DropDownList1.DataBind();这样应该就可以了 但是奇怪的很,最开始的代码是微软asp.net快速入门例程给的,这么马虎?? DropDownList1.DataSource = ds.Tables["Authors"].DefaultView; DropDownList1.DataTextField = ds.Tables["Authors"].Columns[0].ToString(); DropDownList1.DataValueField = ds.Tables["Authors"].Columns[0].ToString(); DropDownList1.DataBind(); 少了DropDownList1.DataTextField=字段名DropDownList1.DataValueField=字段名 订单如何打印最方便? 精神崩溃!找不到文件或程序集Ajax,或找不到它的一个依赖项!这是怎么回事? 按钮事件无响应! 水晶报表10的打印问题 ASP.net 程序员 请问对于asp的table如何使用js去控制接收判断呢 DataGrid显示时能否象Table一样可以加上Rowspan? asp.net2.0 代码页的命名空间和控件的声明不见了 如何实现下载功能 我想把一个数组绑到DataGrid上,一开始的时候还能用,后来不知怎么就不能用了?help 获取客户端用户的 Windows 登录名(C#) media service 配置 问题严重 播放自己的流
// SqlConnection myConnection = new SqlConnection("User ID=sa;Initial Catalog=pubs ;Data Source=(local);PassWord=");
// SqlCommand myCommand = new SqlCommand("select distinct State from Authors", myConnection);
// ArrayList a = new ArrayList();
//
// myConnection.Open();
//
// SqlDataReader dr = myCommand.ExecuteReader();
//
// while(dr.Read())
// {
// a.Add(dr.GetSqlString(0));
// }
//
// dr.Close();
// myConnection.Close();
//
// DropDownList1.DataSource = a;
// DropDownList1.DataBind();只好这么搞定,但是我很想知道是不是数据绑定会有很多问题????
DropDownList1.DataTextField=字段名
DropDownList1.DataValueField=字段名
DropDownList1.DataBind();
这样应该就可以了
DropDownList1.DataTextField = ds.Tables["Authors"].Columns[0].ToString();
DropDownList1.DataValueField = ds.Tables["Authors"].Columns[0].ToString();
DropDownList1.DataBind();
DropDownList1.DataTextField=字段名
DropDownList1.DataValueField=字段名