Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Wait for it

Status
Not open for further replies.

inteleserve

IS-IT--Management
Dec 13, 2002
75
US
I need to open a connection to a database that may be in use by another program and unavailble to my asp page.

Could someone show me an example on an If Then or somthing that would allow the page to wait for the file to be availble and then open it?

Or if you know of another post ... which I havn't found yet could you point me in that direction?

 
You could try to capture the error generated wen the connection fails. Using On Error Resume Next to force it to pass the error and then somehting like this:
Code:
On Error Resume Next

'make my conneciton object
Dim conn
conn.Open("my connection string here")

'check for errors
If err.Number <> 0 Then
   Response.Write "The resource you are trying to view is currently undergoing internal revision, please try again later"
   Response.End
End If

I don't know why that error message popped into my head, but I though it might be a god example. if this is a public website say something vague like that, don't tell the world you have Access and etc.

As for waiting for it to be available, that could be very bad for your server. If it isn't available for 5 minutes and you do something like use a Sleep function, then you will be chewing through memory and CPU for 5+ minutes. In fact the pag will probably time out at some point and then your client gts a nasty error page instead of your own warm and reasuring (we're a little busy" page (add flowers and bunny rabbits, everyone likes flowers and bunny rabbits :p).

-T

01000111 01101111 01110100 00100000 01000011 01101111 01100110 01100110 01100101 01100101 00111111
The never-completed website:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top