"Initial Catalog=myDatabase;" & _
"User ID=myUsername;" & _
"Password=myPassword;"
Then use a Shape command with SQL strings:
sSQL = "SHAPE {select * from authors} " & _
"APPEND ({select * from titleauthor} AS chapter " & _
"RELATE au_id TO au_id)"
Or use a Shape command that calls Stored Procedures:
sSQL = "SHAPE {exec spAuthors_LoadAll} " & _
"APPEND ({exec spTitleAuthor_LoadAll} AS chapter " & _
"RELATE au_id TO au_id)"
For more information, see: Microsoft Data Shaping Service for OLE DB and Q288409
.NET Managed Provider Connections
SQL Client .NET Managed Provider (System.Data.SqlClient)
The SQL Client .NET Managed Provide allows you to connect to a Microsoft SQL Server 7.0
or 2000 database. For Microsoft SQL Server 6.0 or earlier, use the OLE DB .NET Data Provider
with the "SQL Server OLE DB Provider" (SQLOLEDB).
Dim oSQLConnection As SqlClient.SqlConnection
Dim sConnString As String
sConnString = "Data Source=(local);" & _
"Initial Catalog=NorthWind;" & _
"Integrated Security=SSPI;" & _
"Pooling=True;" & _
"Min Pool Size=10;" & _
"Max Pool Size=50;" & _
"Connection Lifetime=30;" & _
"Connection Reset=True;" & _
"Enlist=True;"
oSQLConnection = New SqlClient.SqlConnection(sConnString)
oSQLConnection.Open()
For more information, see: System.Data.SQL Namespace and .NET Data Providers
Note: 'SQL' namespace got renamed to 'SQLClient'
OLE DB .NET Managed Provider (System.Data.OleDb)
The OLE DB .NET Data Provider uses native OLE DB through COM interop to enable data access.
To use the OLE DB .NET Data Provider, you must also use an OLE DB provider (e.g. SQLOLEDB,
MSDAORA, or Microsoft.JET.OLEDB.4.0).
For SQL Server OLE DB Provider (for SQL Server 6.0 or earlier)
Dim oOleDbConnection As OleDb.OleDbConnection
Dim sConnString As String
sConnString = "Provider=sqloledb;" & _
"Data Source=myServerName;" & _
"Initial Catalog=myDatabaseName;" & _
"User Id=myUsername;" & _
"Password=myPassword;"
oOleDbConnection = New OleDb.OleDbConnection(sConnString)
oOleDbConnection.Open()
For JET OLE DB Provider:
Dim oOleDbConnection As OleDb.OleDbConnection
Dim sConnString As String
sConnString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\Work\nwind.mdb;" & _
"User ID=Admin;" & _
"Password="";"
oOleDbConnection = New OleDb.OleDbConnection(sConnString)
oOleDbConnection.Open()
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 |