February 23, 2019
Hot Topics:

Switch from DAO to ADO

  • November 20, 2002
  • By Sam Huggill
  • Send Email »
  • More Articles »

With ADO, you can build all your code around a local database and then, very easily change one line of code that will allow you to access a database on a SQL Server.

The thing that took me a while to figure out, was how to connect to a database. With DAO, you use the OpenDatabase command passing the path of the database as one of the arguements. But with ADO, you need to build a connection string. To connect to a local database, use the following connection string:

ConnectionString = "Provider=Microsoft.JET.OLEDB.3.51; _
                   Data Source=c:\mydb.mdb"

That may seem a bit cumbersome, but this flexibility provides you with the means to connect to almost any database in any format anywhere. The following connection string is used to connect to a SQL Sever database named 'people':

ConnectionString = "driver=[SQLServer]; _

Page 2 of 5

Comment and Contribute


(Maximum characters: 1200). You have characters left.



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