To create a Universal Data Link (.udl) file
-
Open Windows Explorer.
-
Select the folder in which you want to store the .udl file.
-
If you are running Windows 2000 or later, select New on the File menu, and choose Text Document. A new file named New Text Document.txt appears in the directory. Rename this file, removing all spaces and changing its file extension to .udl.
Note A warning that changing file extensions can cause files to become unusable might appear. Disregard it.
If you are running Windows 98 and Windows NT systems with Microsoft Data Access Components (MDAC) installed, right-click the right pane, or results pane, select New, and choose Microsoft Data Link. A new file named New Microsoft Data Link.udl appears in the directory. You can rename this file.
-
Double-click the universal data link (.udl) file.
To configure Data Control to use a .udl file to connect to a DataSource
In the following example, the ConnectionString property of a control named cnPubs is set to a universal data link file named Pubs.udl, whose absolute path is given:
cnPubs.ConnectionString = "File Name=C:\Path\To\Pubs.udl;"
You also can give a relative path:
cnPubs.ConnectionString = "File Name=Data\Pubs.udl;"
If you give a relative path, the specified universal data link file will be located beginning from the directory where the application is installed.