For more information, see: System.Data.OleDb Namespace and .NET Data Providers
Note: 'ADO' namespace got renamed to 'OleDb'
ODBC .NET Managed Provider (System.Data.ODBC)
The ODBC .NET Data Provider is an add-on component to the .NET Framework SDK Beta 2.
It provides access to native ODBC drivers the same way the OLE DB .NET Data Provider
provides access to native OLE DB providers.
For SQL Server ODBC Driver:
Dim oODBCConnection As Odbc.OdbcConnection
Dim sConnString As String
' Create and open a new ODBC Connection
sConnString = "Driver={SQL Server};" & _
"Server=MySQLServerName;" & _
"Database=MyDatabaseName;" & _
"Uid=MyUsername;" & _
"Pwd=MyPassword;"
oODBCConnection = New Odbc.OdbcConnection(sConnString)
oODBCConnection.Open()
For Oracle ODBC Driver:
Dim oODBCConnection As Odbc.OdbcConnection
Dim sConnString As String
' Create and open a new ODBC Connection
sConnString = "Driver={Microsoft ODBC for Oracle};" & _
"Server=OracleServer.world;" & _
"Uid=myUsername;" & _
"Pwd=myPassword;"
oODBCConnection = New Odbc.OdbcConnection(sConnString)
oODBCConnection.Open()
For Access (JET) ODBC Driver:
Dim oODBCConnection As Odbc.OdbcConnection
Dim sConnString As String
' Create and open a new ODBC Connection
sConnString = "Driver={Microsoft Access Driver (*.mdb)};" & _
"Dbq=c:\somepath\mydb.mdb;" & _
"Uid=Admin;" & _
"Pwd=;"
oODBCConnection = New Odbc.OdbcConnection(sConnString)
oODBCConnection.Open()
For all other ODBC Drivers:
Dim oODBCConnection As Odbc.OdbcConnection
Dim sConnString As String
' Create and open a new ODBC Connection
sConnString = "Dsn=myDsn;" & _
"Uid=myUsername;" & _
"Pwd=myPassword;"
oODBCConnection = New Odbc.OdbcConnection(sConnString)
oODBCConnection.Open()
For more information, see: Download Center