MS-Access Connection denied for 1 min after Query
I'm setting up a search page for a database, and using the code below to test the script on a very simple test database. The search works great the first time. However, when I return to the search page using either "Back" on the browser, or the "Return" link on the results page and try a new search I get the following error:
Error Type:
Provider (0x80004005)
Unspecified error
/response1.asp, line 24
After about 1 minute this error clears and the new search can be performed.
How can this problem be corrected?
Any help would be much appreciated! Thanks.
<%@ LANGUAGE=VBScript %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html dir=ltr>
<HEAD>
<TITLE>Response1.asp File</TITLE>
<META NAME="ROBOTS" CONTENT="NOINDEX">
<META HTTP-EQUIV="Content-Type" content="text/html; charset=Windows-1252">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<H2><CENTER>Search Results Test Page</CENTER></H2>
<%
Dim adoCon
Dim rsGuestbook
Dim strSQL
Dim strName
strName = Request.Form("Name")
Set adoCon = Server.CreateObject("ADODB.Connection")
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("guestbook.mdb")
Set rsGuestbook = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT tblComments.Name, tblComments.Comments FROM tblComments WHERE tblComments.Name='" + strName + "';"
Response.Write ("<BR>Searching for Name of ")
Response.Write (strName)
Response.Write ("<BR><BR>Found:<BR>")
rsGuestbook.Open strSQL, adoCon
if rsGuestbook.EOF and rsGuestbook.BOF then
Response.Write "No Records Found"
else
Do While not rsGuestbook.EOF
Response.Write ("<BR>")
Response.Write (rsGuestbook("Name"))
Response.Write ("<BR>")
Response.Write (rsGuestbook("Comments"))
Response.Write ("<BR>")
rsGuestbook.MoveNext
Loop
end if
rsGuestbook.Close
Set rsGuestbook = Nothing
Set adoCon = Nothing
%>
<BR>
<a href=Form1.htm>Return</a>
</BODY>
</HTML>
|