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 library 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

kiran
  • 1
  • 1

1 Answers1

0

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

Davide Piras
  • 43,984
  • 10
  • 98
  • 147
  • Davide:Thanks for your quick response. drStudents is a IDataReader and this code is working in aps.net 3.5 with enterprise library 4.1, getting an error when i migrate the application to asp.net 4.0 with enterprise library 5.0. 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 – kiran Sep 14 '11 at 23:41