• After placing a data control on a form, you set the ConnectionString
property. The ADO data control can connect to a variety of database types. There
are three ways to connect to a database: using a data link, using an ODBC data
source, or using a connection string. In this lesson, we will look only at connection
to a Microsoft Access database using a data link
. A data link
is a file with a UDL
extension that contains information on database
• If your database does not have a data link, you need to
create one. This process is best illustrated by example. We will be using the
BIBLIO.MDB database in our first example, so these steps show
you how to create its data link:
Open Windows Explorer.
Open the folder where you will store your data link file.
Right-click the right side of Explorer and choose New. From
the list of files, select Microsoft Data Link.
Rename the newly created file BIBLIO.UDL
Right-click this new UDL file and click Properties.
Choose the Provider tab and select Microsoft Jet
3.51 OLE DB Provider (an Access database).
Click the Next button to go to the Connection
Click the ellipsis and use the Select Access Database
dialog box to choose the BIBLIO.MDB file which is in the Visual
Basic main folder. Click Open.
Click Test Connection. Then, click OK (assuming
it passed). The UDL file is now created and can be assigned to ConnectionString,
using the steps below.
• If a data link has been created and exists for your database, click
the ellipsis that appears next to the ConnectionString property.
Choose Use Data Link File. Then, click Browse
and find the file. Click Open. The data link is now assigned
to the property. Click OK.