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
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