我正在尝试将 asp.net 3.5 应用程序迁移到 asp.net 4.0 版本。
迁移到 asp.net 4.0 后,asp.net 3.5 工作正常,出现以下错误
“rptStudents 正在使用无效的数据源。有效的数据源必须实现 IListSource 或 IEnumerable。”
注意:从 4.1 迁移到 Enterprise library 5.0
代码:
Using drStudents As IDataReader = dbStudents.ExecuteReader(cmdStudents)
With rptStudents
.DataSource = drStudents
.DataBind()
End With
结束使用
戴维德:感谢您的快速回复。
drStudents 是 IDataReader,此代码运行良好
将 dbStudents 调暗为数据库 = DatabaseFactory.CreateDatabase("eCONNECTION") 将 cmdStudents 调暗为 DbCommand = dbComments.GetStoredProcCommand("get_students")
使用 drStudents 作为 IDataReader = dbStudents.ExecuteReader(cmdStudents) With rptStudents .DataSource = drStudents .DataBind() End With End Using