|
 |
asp_databases thread: Traping errors
Message #1 by "Bussieres Katie" <kbussieres@p...> on Wed, 30 May 2001 09:31:40 -0400
|
|
Hello,
Sometimes in my application, the database is not accessible. I know that
it is related to the timeout... I would like to be able to display an
message saying that the "database in not available for the moment"
instead of the hugly message usualy displayed. I know that it is
possible to trap errors but what I tried didn't worked. I propraply did
something wrong.
Can somebody help me ???
p.s Sorry for my english I am french canadian !
Thank you
Katie
Message #2 by "Bussieres Katie" <kbussieres@p...> on Thu, 31 May 2001 15:07:52 -0400
|
|
Hello ,
Thank you for your quick response !
I tried what you suggested. Here is my code :
on error resume next
Set adoConnection=3DServer.CreateObject("ADODB.Connection")
adoConnection.ConnectionTimeout=3D250
connectString=3D"proksim-faq"
adoConnection.Open connectString
IF adoConnection.Errors.Count>0 THEN
FOR EACH Y IN adoConnection.Errors
IF Y<>0 THEN
Response.Redirect "error.html"
END IF
NEXT
END IF
But it is not trapping errors when the database is not available !
When there is a problem with the connection, I want to redirect on a
page explaining that it is not possible to connect to the database a the
moment !
Help !
Katie
-----Original Message-----
From: vishal [mailto:vismis@r...]
Sent: Thursday, May 31, 2001 1:17 AM
To: Bussieres Katie
Subject: Re: [asp_databases] Traping errors
Hello,
i have used some omages in my piece of code which you can change
before running it into yoyr file and do let me know if it is working or
not or any other problem on asp or in the database.Try this out :
if err.number=3D0 then
Response.Write
"<br><br><br> <img
src=3D'images/madhackopt.gif'><img src=3D'images/op.jpg'>"
ELSEIF ERR.NUMBER=3D3021 THEN
Response.Write
"<br><br><br><P> <img
src=3D'images/re.gif'>"
ELSEIF ERR.NUMBER=3D-2147217900 THEN
Response.Write
"<br><br><br><P> <img
src=3D'images/na.gif'>"
ELSE
Response.Write ERR.NUMBER &"hfghfgh" & ERR.DESCRIPTION & ERR.SOURCE
end if
IF C.Errors.Count>0 THEN
FOR EACH Y IN C.Errors
IF Y<>0 THEN
Response.Write "<FONT COLOR=3DRED>" & Y.DESCRIPTION & "</FONT>"
END IF
NEXT
END IF
Regards ,
vishal.
------------- Original Message --------------
"Bussieres Katie" <kbussieres@p...> wrote:
To:"ASP Databases" <asp_databases@p...>
From:"Bussieres Katie" <kbussieres@p...>
Date:Wed, 30 May 2001 09:31:40 -0400
Subject: [asp_databases] Traping errors
Hello,
Sometimes in my application, the database is not accessible. I know that
it is related to the timeout... I would like to be able to display an
message saying that the "database in not available for the moment"
instead of the hugly message usualy displayed. I know that it is
possible to trap errors but what I tried didn't worked. I propraply did
something wrong.=3D20
Can somebody help me ???
p.s Sorry for my english I am french canadian !
Thank you
Katie
Message #3 by "Dallas Martin" <dmartin@z...> on Thu, 31 May 2001 16:58:18 -0400
|
|
TRY:
adoConnection.Open connectString
If err.number <> 0 then
response.redirect("error.html")
End if
Dallas Martin
----- Original Message -----
From: "Bussieres Katie" <kbussieres@p...>
To: "ASP Databases" <asp_databases@p...>
Sent: Thursday, May 31, 2001 3:07 PM
Subject: [asp_databases] RE: Re: Traping errors
> Hello ,
>
> Thank you for your quick response !
> I tried what you suggested. Here is my code :
>
>
> on error resume next
> Set adoConnection=Server.CreateObject("ADODB.Connection")
> adoConnection.ConnectionTimeout=250
> connectString="proksim-faq"
> adoConnection.Open connectString
> IF adoConnection.Errors.Count>0 THEN
> FOR EACH Y IN adoConnection.Errors
> IF Y<>0 THEN
> Response.Redirect "error.html"
> END IF
> NEXT
> END IF
>
>
> But it is not trapping errors when the database is not available !
> When there is a problem with the connection, I want to redirect on a
> page explaining that it is not possible to connect to the database a the
> moment !
>
> Help !
>
> Katie
>
>
> -----Original Message-----
> From: vishal [mailto:vismis@r...]
> Sent: Thursday, May 31, 2001 1:17 AM
> To: Bussieres Katie
> Subject: Re: [asp_databases] Traping errors
>
>
> Hello,
> i have used some omages in my piece of code which you can change
> before running it into yoyr file and do let me know if it is working or
> not or any other problem on asp or in the database.Try this out :
>
> if err.number=0 then
> Response.Write
> "<br><br><br> <img
> src='images/madhackopt.gif'><img src='images/op.jpg'>"
> ELSEIF ERR.NUMBER=3021 THEN
> Response.Write
> "<br><br><br><P> <img
> src='images/re.gif'>"
> ELSEIF ERR.NUMBER=-2147217900 THEN
> Response.Write
> "<br><br><br><P> <img
> src='images/na.gif'>"
> ELSE
> Response.Write ERR.NUMBER &"hfghfgh" & ERR.DESCRIPTION & ERR.SOURCE
> end if
>
> IF C.Errors.Count>0 THEN
>
> FOR EACH Y IN C.Errors
>
> IF Y<>0 THEN
> Response.Write "<FONT COLOR=RED>" & Y.DESCRIPTION & "</FONT>"
> END IF
> NEXT
>
> END IF
>
> Regards ,
> vishal.
>
>
>
> ------------- Original Message --------------
> "Bussieres Katie" <kbussieres@p...> wrote:
> To:"ASP Databases" <asp_databases@p...>
> From:"Bussieres Katie" <kbussieres@p...>
> Date:Wed, 30 May 2001 09:31:40 -0400
> Subject: [asp_databases] Traping errors
>
> Hello,
>
> Sometimes in my application, the database is not accessible. I know that
> it is related to the timeout... I would like to be able to display an
> message saying that the "database in not available for the moment"
> instead of the hugly message usualy displayed. I know that it is
> possible to trap errors but what I tried didn't worked. I propraply did
> something wrong.
>
> Can somebody help me ???
>
> p.s Sorry for my english I am french canadian !
>
> Thank you
> Katie
|
|
 |