PDA

View Full Version : database cannot be found


reubenb
10-11-2005, 06:41 AM
is it possible in a database include file, to when there is a 'database not found' error, to redirect a user to another page?

thx

TheShaner
10-11-2005, 06:34 PM
Yes, you the On Error Resume Next command right before where this error would occur (which is where you attempt to connect to the db). Like so:

On Error Resume Next
'Attempt DB Connection
If Err.Number <> 0 Then
'Redirect user here
End If

This is using VBScript of course.

-Shane

reubenb
10-12-2005, 04:51 AM
It dosen't work, it just times out?

TheShaner
10-12-2005, 04:21 PM
Where did you put the error catching? In the include file or the page with the include? Try both places and see if either works. Other than that, no idea.

-Shane

reubenb
10-13-2005, 02:14 PM
in a function in the include file..
doesn't wrk/

neocool00
10-13-2005, 04:18 PM
I believe that if you put it in a function, it will only work in that function.

reubenb
10-13-2005, 04:21 PM
its a create db connection function though?

neocool00
10-13-2005, 04:33 PM
Sorry, should have explained better (or maybe I mis-interpreted your reply). You should put the On Error Resume Next at the beginning of the function that opens the database. When I originally read your message, I was thinking that you had put the error checking code in a seperate function.