PDA

View Full Version : Problem with ASP and Access


jorr1013
06-16-2003, 04:32 PM
I have an interesting problem with my ASP page that is using an Access database. It appears to not be closing the database correctly or something because if two people submit to it within about 10 seconds of each other, the second one will get an error on the line with the ".open" command. Otherwise, it works correctly.

At the end of the ASP page, I am closing all of the open files and setting all of the variables " = Nothing ". So does anyone have any ideas why it is behaving like this?

Thanks.

-John

fyrye
06-16-2003, 06:11 PM
using ADO or DNS?

MDE is a converted MDB file with out the forms and macros etc just has database tables. Lessens size and speeds up database.

As well never use SELECT * From tbl
Alway chanfe * with the fields you are calling
SELECT field1, field2, field3, field4 From tbl

ADO example...

DatabaseConnection = "Driver={Microsoft Access Driver (*.mdb)};DBQ=" &server.MapPath("db/database.mde")&";"

if varType(conn)=0 or varType(conn)=1 then
set conn = server.createObject("adodb.connection")
conn.Open DatabaseConnection
end if

set rs = server.createObject("adodb.recordset")
rs.cursorLocation = adUseClient
rs.cacheSize = numPerPage
rs.open SELECT field from tbl, connTemp

on error resume next
rs.close
set rs = nothing
conn.close
set conn = nothing


sry if this incorrect in someway but I converted to Functions along time ago and have forgotten the manual way of coding this on everypage..... hint hint!

all i do for my querries-

SQL = "Select Field from tbl"
call opendatabase(SQL, rs)
while not rs.eof
response.write(rs("field"))
rs.movenext
wend

call closedatabase()

jorr1013
06-17-2003, 07:48 AM
Good information. Thank you.

-John