Solved

VB.Net OleDbDataReader Vs SqlDataReader

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

Suggested Solutions

Title # Comments Views Activity
SQL Syntax 24 42
table joins in qry 17 58
Testing of the web services 1 31
SSRS Deployment problem 5 63
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

790 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