Error when binding repeater control with IDataReader after converting 3.5 to 4.0

Topics: Data Access Application Block
Sep 16, 2011 at 11:07 PM

I am trying to migrate 3.5(enterprise library 4.1) working application to 4.0 (enterprise library 5.0) version.

My Application ( 3.5) is working without any issues on production, after migrating to 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


Using drStudents As IDataReader = dbStudents.ExecuteReader(cmdStudents)
With rptStudents
.DataSource = drStudents //gettting an error, rptStudents is a repeater control
End With
End Using
Thanks in advance
Sep 19, 2011 at 3:38 AM


It seems like you are not binding to the correct data type. Is drStudents a SqlDataReader? Try storing first the data that you get from drStudents in a container that implements IListSource or IEnumerable, such as List<T>. Then, try passing in that container as the data source of rptStudents.

My two cents. :-)

Sep 19, 2011 at 4:18 PM

Hi CodeTrainer,

Thanks for your response.

drStudents is a IDataReader type and this code is working good in production with Enterprise library 3.5, I am getting the error after upgraded to Enterprise library 5.0 without any code changes.

I searched online for a solution but every post suggests code changes.

Please advise me how to make it work without any code changes.

Sep 20, 2011 at 2:27 AM


Sorry but I do not know of any other way to proceed without code changes.

Sep 22, 2011 at 10:58 AM

Unfortunately, modifying your code is the only option you may have since some Entlib code has been refactored on version 5.0.


Noel Angelo Bolasoc
Avanade Software
Avanade, Inc.
Contact Us