SqlDataReader & IEnumerable

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi.

SqlDataReader and OleDbDataReader support IEnumerable interface. When I
looked up IEnumerable.GetEnumerator for SqlDataReader, it says the following:

This member supports the .NET framework infrastructure and is not intended
to be used directly from your code.

What does this mean? It works, but you can't use it?

Is there a way to enumerate the resulting rows using the interfaces? Here,
I want to return the IEnumerator interface for processing. This way, it
doesn't matter if the data is coming from SQL server or Oracle.

public IEnumerator GetItems( ... )
{

}

Thanks.
J
 
If you want to make your data access code provider agnostic use
IDbConnection, IDataReader etc.

Jan
 
Back
Top