SQLDataReader vs. IDataReader

  • Thread starter Thread starter Vivek Sharma
  • Start date Start date
V

Vivek Sharma

Hi There,

can some one please clarify the difference between SQLDataReader and
IDataReader? What are the advantages and disadvantages of each?

Thanks
Vivek
 
hi
The IDataReader is interface which allow an inheriting class to implement a
DataReader class, which provides a means of reading one or more forward-only
streams of result sets

SqlataReader is a class that implements this IDataReader interface.

the diffrence is IDataReader is an interface and SqlataReader is a class
which implements that interface

regards
Ansil
Dimensions
Technopark
Trivandrum
(e-mail address removed)
 
Hi Vivek:

IDataReader is an interface for all of the DataReader classes inherit
from. If you want your code to be provider agnostic then you'd need to
program against the IDataReader interface. With a careful design you
can switch from SQL Server and a SqlDataReader to Oracle and an
OracleDataReader with little or no changes to your code. The
disadvantage is you won't be able to take advantage of any special
features a provider offers.

There is a small example here:
http://support.microsoft.com/kb/313304/EN-US/
 
Back
Top