Microsoft KB Archive/274536

From BetaArchive Wiki
Knowledge Base


How To Specify a UDL File as the Source of Connection Attributes for a VB Data Environment Connection Object

Article ID: 274536

Article Last Modified on 7/13/2004



APPLIES TO

  • Microsoft Visual Basic 6.0 Professional Edition
  • Microsoft Visual Basic 6.0 Enterprise Edition
  • Microsoft Data Access Components 2.0
  • Microsoft Data Access Components 2.1
  • Microsoft Data Access Components 2.1 Service Pack 1
  • Microsoft Data Access Components 2.1 Service Pack 2
  • Microsoft Data Access Components 2.5
  • Microsoft Data Access Components 2.5 Service Pack 1
  • Microsoft Data Access Components 2.6



This article was previously published under Q274536

SUMMARY

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.

MORE INFORMATION

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:

File Name=C:\PUBS.UDL
                

REFERENCES

For additional information, click the article numbers below to view the articles in the Microsoft Knowledge Base:

189680 How To Use Data Link Files with ADO 2.0


244659 MDAC 2.5 Sample How to Create a Data Link File with Windows 2000


Keywords: kbhowto KB274536