Select the product you need help with
- Internet Explorer
- Windows Phone
- More products
How To Specify a UDL File as the Source of Connection Attributes for a VB Data Environment Connection Object
Article ID: 274536 - View products that this article applies to.
This article was previously published under Q274536
Microsoft Data Links provide a simple interface to test an ActiveX Data Object (ADO) connection to a data source by using an OLEDB provider or an Open Database Connectivity (ODBC) driver. The connection information specified when setting up and testing an ADO connection using a data link is stored in a specified Universal Data Link (.udl) file. A .udl file can be specified as the source of connection attributes for an ADO Connection object by assigning the .udl file's path to the "File Name" parameter in its ConnectionString property.
The Data Environment in Visual Basic 6.0 provides a graphical user interface (GUI) to set up ADO Connection and Command objects for use in a Visual Basic application. A Data Environment Connection object's properties are typically set by navigating through a tabbed Properties dialog box and specifying the desired connection attributes like the OLE DB provider to use, the Database to connect to, the database user id and password, and so forth. A .udl file can also be used to specify the connection attributes for a Data Environment connection object. However, the Data Environment Connection object's Properties dialog box does not provide an option to select a .udl file as the source of the connection attributes.
To specify a .udl file as the source of connection attributes for a Data Environment connection object, you need to manually set the ConnectionSource property in its properties list box (accessed by selecting the Data environment connection object and pressing the F4 key).
The ConnectionSource property needs to be set to an ADO connection string of the format File name=<path to the .udl file>. For instance, assuming that you have a .udl file in the C:\ folder with the name of PUBS.UDL that connects to the SQL Server PUBS sample database, you would assign the following string to the ConnectionSource property of the Data Environment connection object to specify PUBS.UDL as the source of connection attributes:
For additional information, click the article numbers below to view the articles in the Microsoft Knowledge Base:
(http://support.microsoft.com/kb/189680/EN-US/ )How To Use Data Link Files with ADO 2.0
(http://support.microsoft.com/kb/244659/EN-US/ )MDAC 2.5 Sample How to Create a Data Link File with Windows 2000
Article ID: 274536 - Last Review: July 13, 2004 - Revision: 2.2