tags:

views:

122

answers:

5

Currently I can connect to a local .mdb with an Oledb connection. I am able to query, add, update and delete the database with correct results.

How would connecting to an ODBC database differ in terms of c# usage from an Oledb database?

A: 

The connection would likely only differ in connection string (and possibly setting up an ODBC connection in Control Panel), but the .NET classes for connection all implement IDbConnection/Command/Transaction etc so are very similar. In C# you have OleDbConnection and OdbcConnection, I believe - but again both implement the base interfaces.

A short overview can be found here:

http://database.ittoolbox.com/documents/odbc-vs-oledb-18150

Most database vendors support ODBC as it was designed to be a sort of shared connection mechanism, but again most vendors supply or prefer another (Oracle ADO.NET Provider, MySQL Provider, etc).

Either go generic, or if its only a small application, go for the one most suited to the target database.

Adam
+1  A: 

See the following link ..its more clear

http://www.maxi-pedia.com/What+is+the+difference+between+ODBC+and+OLEDB

Vivek Saurabh
You forgot the link.
John Saunders
A: 

How would connecting to an ODBC database differ in terms of c# usage from an Oledb database?

It wouldn't with c# and the standard .net data provider if you are using simple sql statements e.g. select update delete etc. The difference would be that ODBC would need a DSN set up to use it, although even this is not strictly true.

Ed

Ed Bishop
+1  A: 

Microsoft designed ODBC to access SQL data and OLE DB to access any type of data in a COM environment. In short...

Johnny Quest
+1  A: 

My primary experience is C/C++ and ODBC, but I have also used ODBC and OLEDB with C#.

Using ODBC with C# involves an abstraction layer between the actual ODBC API calls and the program, so in some cases you may find that optimizing the driver usage is more difficult or impossible. For general usage and simple queries you should be fine.

OLE DB is designed to be used with C# so all the API calls should be available.

Winder
OLE DB was designed to be used with just C#?
Johnny Quest