Learn how to connect to different kinds of databases in ASP.Although our ASP database tutorials all use MS Access connection strings, there are many sorts of database software out there for use with ASP. This tutorial will show you how to connect with them.
MS ACCESS
First, we'll take a look at the regular MS Access Connection String:
| Set Conn = Server.CreateObject("ADODB.Connection") Conn.connectionstring = "Provider=Microsoft.Jet.OLEDB.4.0; DBQ=" _ & Server.Mappath("db/users1.mdb") & "User ID=Administrator;Password=rev01t;" Conn.Open |
| Set Conn = Server.CreateObject("ADODB.Connection") Conn.connectionstring = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" _ & Server.Mappath("db/users1.mdb") & ";User Id=Administrator;Password=rev01t;" Conn.Open |
MS SQL
This is a less common alternative to Access databases, most commonly used by large scale websites. Here's our connectionstring to SQL:
| set Conn = server.createobject("ADODB.Connection") Conn.open "PROVIDER=SQLOLEDB;DATA SOURCE=servername;User ID=username;_ Password=password;DATABASE=databasename;" |






