473,394 Members | 1,709 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

SQLDataReader vs. IDataReader

Hi There,

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

Thanks
Vivek
Nov 16 '05 #1
2 11723
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
an****@gmail.com

"Vivek Sharma" wrote:
Hi There,

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

Thanks
Vivek

Nov 16 '05 #2
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/

--
Scott
http://www.OdeToCode.com/blogs/scott/
On Thu, 18 Nov 2004 14:05:26 +1300, "Vivek Sharma"
<jo*******@news.com> wrote:
Hi There,

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

Thanks
Vivek


Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Franck Diastein | last post by:
Hi, when I call ExportData I have this error: Invalid attempt to Read when reader is closed. Telling me that there's a problem with this line: while(_dataR.Read()){ Code:...
5
by: Woody Splawn | last post by:
I have some code that looks like this: Dim SSN, LName, FName, M As String mySqlConnection = New SqlConnection(myConnectionString) Dim sql_Command As New SqlCommand( _ "Select SSN, LName, FName,...
4
by: Mahesh Kumar.R | last post by:
What is the difference between SqlDataReader and IDataReader ...? kindly with small example... Mahesh~
2
by: יוני גולדברג | last post by:
Hi, In few places within my code the business object pass IDataReader to the GUI. Suddenly i noticed that nowhere in the code the IDataReader is being closed. Does the data binding operation...
2
by: teresa | last post by:
Hi Everyone, I appreciate any help if any of you know or have used this method before and can give me some suggestion. It's a bit difficult to explain: Here is my table: Table1: there are...
2
by: jarod1701 | last post by:
Hi everyone, is there a way to access every record from a SqlDataReader via "foreach" ? I want to write a class which (besides doing some other stuff) retrieves a recordset using...
13
by: lithoman | last post by:
I'm stumped here. I run the procedure Batch_Select against the database with @ID=18 and I get the expected data. When it loads into a SqlDataReader, it gets messed up somehow. Initially, after the...
3
by: Frank Milverckowitz | last post by:
Hi, Newbie question about SqlDataReader column value access... In java jdbc code to get a value from a table column we can pass the column name (instead of an int index or offset): String...
3
by: CSharper | last post by:
I have a common program where I have a method which make a sql connection and then prepares a SqlDataReader that is passed to the calling method. But in the common method, I have the connection...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.