Forum Moderators: open

Message Too Old, No Replies

DB error on page refresh ... not on reload

Refresh button crashes it, but leaving page and returning works fine

         

rockym

8:12 pm on Mar 23, 2004 (gmt 0)

10+ Year Member



I'm using the following code to connect to my test database (pulled straight from a WROX book).
It works fine to connect if i type in url, however, when i am ON the page, if i hit refresh, i get:
"Provider error '80004005'

Unspecified error

/test/test/connect2.asp, line 24 "

Line 24 is the line reading: objConn.Open "DSN=Test"

I'm not sure what is going on here ...

<%
Dim objConn, objRS
Dim adOpenForwardOnly, adLockReadOnly, adCmdTable

adOpenForwardOnly = 0
adLockReadOnly = 1
adCmdTable = 2

Set objConn = Server.CreateObject("ADODB.Connection")
Set objRS = Server.CreateObject("ADODB.Recordset")

objConn.Open "DSN=Test"

objRS.Open "Names" , objConn, adOpenForwardOnly, adLockReadOnly, adCmdTable

While Not objRS.EOF
Response.Write objRS("QuoteID") & "<BR>"
objRS.MoveNext
Wend

objRS.Close
ObjConn.Close
Set objRS = Nothing
Set objConn = Nothing
%>

rockym

8:26 pm on Mar 23, 2004 (gmt 0)

10+ Year Member



Actually, on further testing, it seems to be more a problem with time...
If I just leave the page open for a while (maybe 1 minute or so) and hit refresh it works again.
Is it possible that perhaps it isn't closing the connection when it finishes printing the records, and therefore can't open up another connection.
But leaving the page via the back button does close the connection so i can reopen it again very quickly that way?