PDA

Click to See Complete Forum and Search --> : connecting a db using asp and ado - newbie


mfoster
Feb 17th, 2001, 01:04 PM
Hi

I bought some cheap web space the other day on an NT server so I could play around with ASP and databases.

I am trying to upload an Access database - ( I'll use SQl server once i know what I'm doing:)

The company gave me this as an instruction

"DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.mappath("/")\ &
"<dbname>.mdb;DefaultDir=" & Server.mappath("/")\ & "
\<username>;DriverId=25;FIL=MS
Access;MaxBufferSize=512;PageTimeout=5;UID=<username>;PWD=mypassword"
(the above must be placed on one line)

The idea is that I put the above in ADO connection string so saying that my db is called DBtest.mdb and my username is mfoster, how should I fill out my connection string and do I upload the mdb file to my mfoster root directory on the server

i can't get my head around the mappath function so I'm not sure what I should be filling in !
I hope this makes sense to someone

thanks
Mark

Kagey
Feb 17th, 2001, 07:43 PM
I use this connection string to connect to my database. Make sure you rename db.mdb to your database name, and the username and password appropriatly.



Set Conn = Server.CreateObject("ADODB.Connection")

Conn.Open "DBQ=" & Server.Mappath("db.mdb") & ";Driver={Microsoft Access Driver (*.mdb)};UID=USERID;PWD=PASSWORD"



if you have anymore questions, just reply.

mfoster
Feb 19th, 2001, 04:14 AM
Hi

That worked perfectly - many thanks

Mark