Solved

VB.Net OleDbDataReader Vs SqlDataReader

Posted on 2009-07-09
5
1,510 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 2

Accepted Solution

by:
lppperes earned 500 total points
ID: 24820271
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
ID: 24820568
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
ID: 24820623
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
ID: 24820635
Will it be better performance wise if I use SqlDataReader on SQL Server?
0
 
LVL 2

Expert Comment

by:lppperes
ID: 24820663
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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
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.
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

695 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