PDA

Click to See Complete Forum and Search --> : Opening database in ASP


Sastraxi
May 5th, 2001, 10:26 AM
I'm a bit new with ASP...

Well, I can use the Request object, the Response object, but when it comes down to databases, I'm a goner.

I have the code that I want executed and it will work, but how do I refrence a database without a DSN? I just have the file (trivia.mdb) but have trouble refrencing it with:

recSrc = " Driver={Microsoft Access Driver (*.mdb)};DBQ=trivia.mdb"
I know that the MDB is in the same dir as the ASP (c:\inetpub\wwwroot\games\tokentag\) and I know it's http path too (http://starwars/games/tokentag/), so how would I go about doing this?

sail3005
May 5th, 2001, 02:45 PM
Try using a DSN-less connection like this:

objConn.ConnectionString = "DRIVER={Microsoft Access Driver (*.mdb)};" & "DBQ=" & Server.MapPath("trivia.mdb")

Sastraxi
May 5th, 2001, 06:38 PM
SWEET!
It actually works!

So, Server.MapPath turns the enclosed string into the virtual path, so that it can read the database right?

sail3005
May 7th, 2001, 04:56 PM
Yep, thats what it does.