Die Open Database Connectivity (ODBC) .NET Datenquellen (Data Provider) stellen den Zugriff auf native ODBC-Treiber auf dieselbe Art und Weise zur Verfügung wie die OLE DB .NET Datenquellen (Data Provider) den Zugriff auf native OLE DB Datenquellen ermöglicht.
Hinweis: Die folgenden Inhalte werden nur in Version 1.1 des .NET Frameworks unterstützt.
Verwendung des SQL Server ODBC-Treibers:
1 2 3 4 5 6 7 8 9 10 11 12 |
' VB.NET Imports System.Data.Odbc ... Dim oODBCConnection As OdbcConnection Dim sConnString As String = _ "Driver={SQL Server};" & _ "Server=MySQLServerName;" & _ "Database=MyDatabaseName;" & _ "Uid=MyUsername;" & _ "Pwd=MyPassword" oODBCConnection = New Odbc.OdbcConnection(sConnString) oODBCConnection.Open() |
Verwendung des Oracle ODBC-Treibers:
1 2 3 4 5 6 7 8 9 10 11 |
' VB.NET Imports System.Data.Odbc ... Dim oODBCConnection As OdbcConnection Dim sConnString As String = _ "Driver={Microsoft ODBC for Oracle};" & _ "Server=OracleServer.world;" & _ "Uid=myUsername;" & _ "Pwd=myPassword" oODBCConnection = New Odbc.OdbcConnection(sConnString) oODBCConnection.Open() |
Verwendung des Access (JET) ODBC-Treibers:
1 2 3 4 5 6 7 8 9 |
' VB.NET Imports System.Data.Odbc ... Dim oODBCConnection As OdbcConnection Dim sConnString As String = _ "Driver={Microsoft Access Driver (*.mdb)};" & _ "Dbq=c:\somepath\mydb.mdb;" oODBCConnection = New Odbc.OdbcConnection(sConnString) oODBCConnection.Open() |
Verwendung des Sybase System 11 ODBC-Treibers:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
' VB.NET Imports System.Data.Odbc ... Dim oODBCConnection As OdbcConnection Dim sConnString As String = _ "Driver={Sybase System 11};" & _ "SRVR=mySybaseServerName;" & _ "DB=myDatabaseName;" & _ "UID=myUsername;" & _ "PWD=myPassword" oODBCConnection = New OdbcConnection(sConnString) oODBCConnection.Open() |
Verwendung anderer ODBC-Treiber:
1 2 3 4 5 6 7 8 9 10 |
' VB.NET Imports System.Data.Odbc ... Dim oODBCConnection As OdbcConnection Dim sConnString As String = _ "Dsn=myDsn;" & _ "Uid=myUsername;" & _ "Pwd=myPassword" oODBCConnection = New Odbc.OdbcConnection(sConnString) oODBCConnection.Open() |