473,769 Members | 2,143 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 11752
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.co m

"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
OracleDataReade r 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
2363
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: ************************************************* public void Export2CSV(){
5
6594
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, M from Students WHERE (SSN = " + " '" + ProposedValue + "')", _ mySqlConnection) Try mySqlConnection.Open()
4
4602
by: Mahesh Kumar.R | last post by:
What is the difference between SqlDataReader and IDataReader ...? kindly with small example... Mahesh~
2
1567
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 closes the IDataReader? If i didn't close it explicitly, the IDataReader remains open untill GC will clean it?
2
6425
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 4 columns in this table as follow: Column1 | Column2 | Column3 | Column4 |
2
16451
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 SqlCommand.ExecuteReader(). Something like: MyDbClass db = new MyDbClass("SELECT * FROM tblUsers");
13
2864
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 reader.Read(), it has a row with 13 data columns, but they're all empty. So, my GetInt() function throws an error. When it jumps to the catch(), reader's columns then show the proper data. What gives? I have reader._data (which is the ID...
3
2831
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 strLastName = rs.getString( "LastName" );
3
1852
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 close method as well. So when the query runs the data reader has data but after the close is called the data reader becomes null. Is there a way I can preserver the data reader after closing the connection?? Thanks.
0
9583
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9990
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8869
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7406
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5445
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3955
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3560
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2814
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.