Before you begin your should check to make sure this you have MDAC v2.1 SP2 or later on installed. To get the latest MDAC goto http://www.microsoft.com/data. If you are are unsure which version of MDAC you have installed Microsoft provides a tool called ComCheck which'll tell you.
A basic OLE DB Connection String looks like this:
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:db1.mdb"
Course you'll have to replace the path above ("C:db1.mdb") with the path and filename of your own database. If the database is located on a ISP ' s server and you don ' t know the physical path of your database can use the server . Mappath () function. Eg:
"Provider=Microsoft.Jet.OLEDB.4.0;Data source=" & Server.MapPath ("/db1.mdb") However it is not recommended Lace your database in a folder that has IIS Read permissions enabled (as any casual web-browser would be able to download t He file if the filename is known).
It is recommended this assign your connection string to a application level global variable or create a include file that contains code, that assigns the connection string to a, local variable, with the include file being in each P Age that requires a database connection). This way if your database ever changes your only need to make one change to your code to enable it to connect to your new D Atabase.
Eg (in your Global.asa):
Sub Application_OnStart
Application ("strdbconnectionstring") = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:db1.mdb"
End Sub
You could need to specify additional parameters for the connection string (eg a User ID and Password, if you have placed a U Sername/password restriction on the database).
The following is a list of additional parameters which can go into the connection string. Each parameter takes the form of:
Parameter Name=value
and is separated from the next parameter by A;
User ID (Default:user id=admin)
Password (default:password= "")
Mode
Extended Properties
Jet Oledb:system
Jet Oledb:registry Path
Jet Oledb:database Password
Jet Oledb:engine Type
Jet oledb:database Locking Mode
Jet Oledb:global Partial Bulk Ops
Jet Oledb:global Bulk Transactions
Jet oledb:new Database Password
Jet oledb:create System Database
Jet Oledb:encrypt Database
Jet Oledb:don ' t Copy Locale on Compact
Jet oledb:compact without Replica Repair
Jet OLEDB:SFP
For a comprehensive list of connection strings (Access or otherwise) check out this page over at able
Consulting