[thelist] asp & access - valid query to db table returning no rows???

Paul Bennett Paul.Bennett at wcc.govt.nz
Thu May 8 05:36:21 CDT 2008


Hi all,

I'm normally a PHP / MySQL person, but need to use ASP / Access for a small project.

I'm connecting to an access database and running a simple select * query but can't get any results returned.

The only thing I can think of is that the file isn't writable...?

Sorry for all the digest users, but the code I'm using is below:
-----------------------
dbpath = "C:\InetPub\Sites\path\to\database\file_name.mdb"

response.write("path: " + dbpath)

Set adoCon=Server.CreateObject("ADODB.Connection")
adoCon.Open "driver={Microsoft Access Driver (*.mdb)};dbq="&dbpath
rs = Server.CreateObject("ADODB.Recordset")

response.write("<p>connection created, db opened</p>")


q= "SELECT * FROM Web_Export"
rs.Open q, adoCon, 3, 3

response.write("<p>query executed : ")
response.write(q)
response.write("</p>")

'Loop through the recordset

if rs.bof and rs.eof then
    response.write("<p>no records</p>")
else
   while not rs.EOF
    response.write(rs.fields(0))
    rs.MoveNext
   wend
end if
-----------------------

*Any* help appreciated.
Thanks,
Paul



More information about the thelist mailing list