January 25, 2021
Hot Topics:

Book Review: Beginning Visual Basic 6 Databases

  • By John Percival
  • Send Email »
  • More Articles »

1    To ensure everything is working, let's go back to our form, frmADOPublishers and right click the ADODC control to bring up the properties page.

2 Choose Build… to bring up the Data Link Properties.  Since we just defined a new ODBC DSN, on the Provider tab select the OLE DB Provider for ODBC Drivers entry. Then click Next >>.

3 Now select our newly minted data source - Our ADO Example DSN - from the drop down box.

Be sure to add Admin for the User Name. However, it is already built into our DSN connection. If you needed to set this up for a specific user, it would be done here. Then click Test Connection to insure everything is fine.

4 Click the Advanced tab and select the Share Deny None choice as shown. Again, you would do this if you wanted to change the defaults defined when the DSN setup was built. But we do it here just to show you how to accomplish this:

5 Click OK and run your program. It works as advertised:

We have just created an ODBC data source that can be used with an Access database. If you needed another data source, you would follow the same steps with that driver. Now the OLE DB provider can take our commands from ADO and translate them to the new ADO ODBC data source. So the OLE DB acts as a universal translator from ADO to whichever ODBC driver we happen to be using.

In In case you were wondering what the connection string looks like, here it is:

Provider=MSDASQL.1;Persist Security Info=False;User ID=Admin;Data Source=Our ADO Example DSN;Mode=Share Deny None

As you can see, all of the required information is now built into the string. Notice that the provider is now MSDASQL.1. We are now accessing the Biblio.mdb database via the ADO data control using ODBC.

Let's take a look at using some VB code to access our data via our new DSN

Page 12 of 23

This article was originally published on November 20, 2002

Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Thanks for your registration, follow us on our social networks to keep up-to-date