HOWTO: Use Data Links to Create a Connection String at Run-TimeID: Q218600
|
This article demonstrates how to programmatically use Data Links feature of the Microsoft Data Access Components in order to generate a connection string at run-time.
In version 2.0 of the Microsoft Data Access Components, Data Links were introduced. Data Link files are similar to ODBC DSN files, but allow you to select an OLE DB provider to connect to your database. With the OLE DB Provider for ODBC drivers, you can also connect to an ODBC data source.
Double-clicking on a Data Link file displays a set of property pages that allow you to build a connection string to connect to your database.
You can use this same functionality in your Visual Basic applications by following the steps listed below:
Private Sub Command1_Click()
Dim objDataLink As New DataLinks
Dim strConn As String
strConn = objDataLink.PromptNew
MsgBox "The connection string you created is:" & _
vbCrLf & strConn
End Sub
For additional information about data links, please see the following
article in the Microsoft Knowledge Base:
Q189680 HOWTO: Use Data Link Files with ADO 2.0
© Microsoft Corporation 1999, All Rights Reserved.
Contributions by David Sceppa, Microsoft Corporation
Additional query words: datalink
Keywords : kbADO200 kbADO210 kbMDAC kbOLEDB200 kbVBp500 kbVBp600 kbGrpVB
Version : WINDOWS:2.0,2.1,5.0,6.0
Platform : WINDOWS
Issue type : kbhowto
Last Reviewed: February 26, 1999