.NET Framework Data Provider for ODBC
This .NET Framework Wrapper Class Library is provided by Microsoft.
The wrapper class library is contained in the file System.Data.dll.
The wrapper class library is contained in the file System.Data.dll.
Coding
Add a reference to the assembly System.Data and include the System.Data.Odbc namespace. Instantiate a new OdbcConnection connection object. Set the connection string and open the connection.
VB.NET code sample
C# code sample
VB.NET code sample
Imports System.Data.Odbc
Dim myConnection As OdbcConnection = New OdbcConnection()
myConnection.ConnectionString = myConnectionString
myConnection.Open()
' execute queries, etc
myConnection.Close()
Dim myConnection As OdbcConnection = New OdbcConnection()
myConnection.ConnectionString = myConnectionString
myConnection.Open()
' execute queries, etc
myConnection.Close()
C# code sample
using System.Data.Odbc;
OdbcConnection myConnection = new OdbcConnection();
myConnection.ConnectionString = myConnectionString;
myConnection.Open();
// execute queries, etc
myConnection.Close();
OdbcConnection myConnection = new OdbcConnection();
myConnection.ConnectionString = myConnectionString;
myConnection.Open();
// execute queries, etc
myConnection.Close();
Description
In .NET framework version 1.0 the driver was contained in a separate download and accessed through the Microsoft.Data.ODBC namespace, since 1.1 it's in .Net framework and contained in the System.Data.Odbc namespace.
The .NET Framework Data Provider for ODBC uses native ODBC Driver Manager through COM interop to enable data access. The OdbcConnection wraps/bridges to the underlying driver sprecified in the connection string using the keyword "Driver" or "DSN" (if the connection should obtain its settings from an ODBC DSN). This means that virtually every ODBC driver can be used through this class library.
The .NET Framework Data Provider for ODBC supports both local and distributed transactions. For distributed transactions, the .NET Framework Data Provider for ODBC, by default, automatically enlists in a transaction. Depending on the functionality supported by the native ODBC driver, some methods or properties of an OdbcConnection object may not be available.
More info about this wrapper class library can be found at the Microsoft product page.
Download link missing
The .NET Framework Data Provider for ODBC installation package download link is missing. Please provide info and contribute to the community by email to
Connection Strings
Additional info or comments on this wrapper class library? Want to submit content?