Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Connecting to MSAccess DB from ASP (DSN-less)

Status
Not open for further replies.

sugarflux

Technical User
Aug 14, 2003
111
GB
Hi all

Been programming with VB for years but fairly new to ASP. I have created a MSAccess database in the root of my webspace (lets call it DB1.mdb) and a table called P with fields PID, PForename, PSurname.

I've created the following as QueryDB.html:

<html>
<body>
<%

DSN="PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" & server.mappath("DB1.mdb") & ";"

Set dbconn = server.createobject("ADODB.Connection")
objconn.open DSN
strsql = "SELECT * FROM P"
set rst = objconn.execute(strsql)
Do while not rst.eof
response.write rst("PForename") & <p>
rst.movenext
loop
rst.close
set rst = nothing
objconn.close
set objconn = nothing
%>
</body>
</html>

I'm getting absolutely nowhere. The above is not connecting to /finding the database. I've tried replacing the DSN line with:
DSN="DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & server.mappath("DB1.mdb") & ";"

Can anyone give me a clue as to where i'm going wrong please?? (My webspace is with 1and1.co.uk if that's important?)

Thanks

sugarflux
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top