Beruflich Dokumente
Kultur Dokumente
Data Links
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
type.
Browse Topics
- Ge tting starte d
- Data Type s
- Module s
- O pe rators in VB6
- VB6 Variable
- VB6 Proce dure s
- VB6 C ontrol Structure s
- Loops in VB6
- VB6 Ex it Do & W ith End
W ith
- Arrays in VB6
- Use r-De fine d Data
Type s
- VB6 C onstants
- VB6 Built-in Functions
- Date and Tim e in VB6
- VB6 C ontrols
- Te x tBox C ontrol
- C om boBox &
O ptionButton
- Labe l & Fram e
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:
1. Open Windows Explorer.
2. Open the folder where you will store your data link file.
3. Right-click the right side of Explorer and choose New. From the list of files,
select Microsoft Data Link.
4. Rename the newly created file BIBLIO.UDL
5. Right-click this new UDL file and click Properties.
6. Choose the Provider tab and select Microsoft Jet 3.51 OLE DB Provider (an Access database).
7. Click the Next button to go to the Connection tab.
8. 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.
Are you a developer? Try out the HTML to PDF API
pdfcrowd.com
9. 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.
pdfcrowd.com