Solved

VB.Net OleDbDataReader Vs SqlDataReader

Posted on 2009-07-09
5
1,416 Views
Last Modified: 2012-05-07
In ASP.Net (3.5)

What is the main difference between  
OleDbDataReader  Vs  SqlDataReader    ?
- performance, versatility, syntax.

Does it make a difference when the Connection in web.config is using providerName="System.Data.SqlClient"
 
0
Comment
Question by:dennisdominic
  • 3
  • 2
5 Comments
 
LVL 2

Accepted Solution

by:
lppperes earned 500 total points
Comment Utility
Hi dennisdominic,
All documentation of microsoft says that you should use SqlDataReader when you connect to a SQL Server database and OleDbDataReader when you connect to a database that doesn´t have a specific data provider (like access databases).
Because all DataReaders, including the OleDbDataReader, the SqlDataReader, and other managed provider's DataReaders implement the same IDataReader interface, they should all provide the same base set of functionality.
If your config is using System.Data.SqlClient, you are using a SQL Server database, so you should use SqlDataReader, that Microsoft recomends.
http://msdn.microsoft.com/en-us/magazine/cc188717.aspx
0
 
LVL 1

Author Comment

by:dennisdominic
Comment Utility
Does it provide more flexibility in the Code to use OleDbDataReader, if I may change from SQL Server to other Database?
 
0
 
LVL 2

Expert Comment

by:lppperes
Comment Utility
Exactly. It is the benefit of using OleDbDataReader: you can change of database type (SQL Server, Oracle, Access, MySQL, etc) without any changes to your code, just to your connection string.
But, if your application will use only one database, it´s better to use a specialized data provider.
0
 
LVL 1

Author Comment

by:dennisdominic
Comment Utility
Will it be better performance wise if I use SqlDataReader on SQL Server?
0
 
LVL 2

Expert Comment

by:lppperes
Comment Utility
All documentation says that. I use OleDb classes, cause my applications always have to work with several databases, and never had problems with performance.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now