无公害农产品申报流程:asp.net中dropdownlist如何绑定,

来源:百度文库 编辑:查人人中国名人网 时间:2024/05/05 23:58:11
我的代码如下,哪有错呢,代码输出,说明没有绑定成功或者reader没成功
connection.Open();
SqlCommand command=new SqlCommand("select GovernmentAgency.GovName from GovernmentAgency,PublicFile where GovernmentAgency.GovCode=PublicFile.GovCode",connection);
SqlDataReader reader = command.ExecuteReader();
drop.DataSource= reader;
drop.DataBind()

drop.DataBind()前面加上
drop.DataTextField="..." /// ... 为某个字段名
drop.DataTextValue="..." /// ... 为某个字段名