Solved

VB.Net OleDbDataReader Vs SqlDataReader

Posted on 2009-07-09
5
1,457 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
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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

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…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

810 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