Error when binding repeater with IDataReader after converting asp.net 3.5 to 4.0
I am trying to migrate asp.net 3.5 application to asp.net 4.0 version.
asp.net 3.5 is working without any issues, after migrating to asp.net 4.0 getting the below error
"An invalid data source is being used for rptStudents. A valid data source must implement either IListSource or IEnumerable."
Note: Migrated to Enterprise lib开发者_如何学Gorary 5.0 from 4.1
Code:
Using drStudents As IDataReader = dbStudents.ExecuteReader(cmdStudents)
With rptStudents
.DataSource = drStudents
.DataBind()
End With
End Using
Davide:Thanks for your quick response.
drStudents is a IDataReader and this code is working good
Dim dbStudents As Database = DatabaseFactory.CreateDatabase("eCONNECTION") Dim cmdStudents As DbCommand = dbComments.GetStoredProcCommand("get_students")
Using drStudents As IDataReader = dbStudents.ExecuteReader(cmdStudents) With rptStudents .DataSource = drStudents .DataBind() End With End Using
What is the actual object type of the drStudents
variable?
It is very clear from the error that IDataReader
or the object you receive is not good anymore as DataSource
and you should pass something that implements IListSource
or IEnumerable
精彩评论