Partager via


Visual Basic Concepts

Creating the Northwind OLE DB Data Link

An essential step in accessing data is creating an OLE DB data source for each database you want to access. The steps below create such an object for the Nwind.mdb (Northwind), supplied with Visual Basic. This data source is used in some of the example procedures supplied with the Visual Basic documentation. You need to create the OLE DB data source only once on a computer.

To create the Northwind OLE DB data source

  1. Open Windows Explorer, or Windows NT Explorer.

  2. Open a directory where you want to create the OLE DB data source. In this example, open Program Files, Microsoft Visual Studio, and VB98.

  3. Right-click the right pane of Explorer, and then click New on the context menu. From the list of file types, click Microsoft Data Link.

  4. Rename the new file Northwind.UDL.

  5. Right-click the file and click Properties on the context menu to display the Northwind.UDL Properties dialog box.

  6. Click the Provider tab.

  7. Select Microsoft Jet 3.51 OLE DB Provider.

  8. Click the Next button to go to the Connection tab.

  9. Click the ellipsis button (…) next to the first text box.

  10. Use the Select Access Database dialog box to navigate to the nwind.mdb file, which is installed in the Program Files\Microsoft Visual Studio\Vb98 directory.

  11. Click Test Connection to check the connection.

  12. If the connection passes, click OK.