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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top