SQLConnection vs. OLEDbConnection

Hi,

Our system will allow users to add different OLEDB connections to connect to different databases. The user choose a provider and other parameters for that OLEDB.

Do you recommend that the program check what provider the user choose and make different connections?

For example, the user add an MSDAORA (oracle) then we make an OLEDbConnection and if the user choose SQLOLEDB we make a SQLConnection or doesn't it matter? Is it bad practice to use OLEDbConnection all the time? (much easier to code...)

I guess most of you will say , use SQLConnection if it's SQL Server, but what's the benefit to  make a SQLConnection instead of an OLEDBConnection with SQLOLEDB or SQLNCLI as the provider?

Thanks.
xlmaster200Asked:
Who is Participating?
 
Daniel WilsonConnect With a Mentor Commented:
>> but what's the benefit to  make a SQLConnection instead of an OLEDBConnection with SQLOLEDB or SQLNCLI as the provider?

Efficiency.  One less middle-man layer.

Is that worth the additional complexity?  That depends on the efficiency requirements of the application.

btw, there's an Oracle .Net provider that's more efficient that the OleDB one also.  If you're interested in top efficiency, you'll use the most appropriate provider each time, falling back to OleDB only when necessary.  The code does get more complex that way, however.
0
 
xlmaster200Author Commented:
Hi, thanks for your answer.

I'll try to follow your advice.

/Nicke
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.