读书人

数据源导入绑定的有关问题(databind)

发布时间: 2011-12-20 22:26:40 作者: rapoo

数据源导入绑定的问题(databind)
有如下程序段:
SqlConnection MyConnection = new SqlConnection( "…… ");
SqlCommand MyCommand = new SqlCommand(sql语句);
MyConnection.Open();
SqlDataReader dr = MyCommand.ExecuteReader();

EmployeeDataList.DataSource =dr;
EmployeeDataList.DataBind();
//DataList1.DataSource = dr;
//DataList1.DataBind();
dr.Close();
MyConnection.Close();
加入注释部分后,datalist1的数据始终不能绑定显示,为什么呢?

[解决办法]
DR已经翻到底了.当然没数据了啊
这样的情况楼主应该FILL DATASET来用

读书人网 >asp.net

热点推荐