dcsimg
July 16, 2018
Hot Topics:

Switch from DAO to ADO

  • November 19, 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]; _
          uid=admin;server=myserver;database=people"




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.

By submitting your information, you agree that developer.com may send you developer offers via email, phone and text message, as well as email offers about other products and services that developer believes may be of interest to you. developer will process your information in accordance with the Quinstreet Privacy Policy.

Sitemap

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