Forums

ASP

This topic is locked

alt message or page if database isn't available

Posted 13 Aug 2001 22:00:55
1
has voted
13 Aug 2001 22:00:55 Brian Compton posted:
I've had to develop an intranet page for my companay that pulls data from 2 different databases. One of the databases is a very shaky CRM database that is down once a week at least. I need help with the code/method/script that can display an alternative message or re-direct if that database isn't available instead of causing the page to be broken. Thanks.

Replies

Replied 15 Aug 2001 14:01:58
15 Aug 2001 14:01:58 Joel Martinez replied:
you can use ASP Error handling... put this code somewhere <b>above</b> the code that hits the shaky DB<pre id=code><font face=courier size=2 id=code>&lt;%on error resume next%&gt;</font id=code></pre id=code>Then put this after the connection/recordset/command has been opened (which means you would get an error message if it was unavailable)<pre id=code><font face=courier size=2 id=code>&lt;%
IF err.number &lt;&gt; 0 THEN
Response.write("CRM unavailable"
response.end
END IF
%&gt;</font id=code></pre id=code>That would of course mean that any errors after the "on error" would just be skipped, which may not be what you want... so if you want, you can put that second bit of code further down on the page, and give it some more generic error handling messages.

Joel Martinez

----------
set rs = conn.execute("SELECT answer FROM brain WHERE question = "& forumPost &"
Replied 15 Aug 2001 14:39:44
15 Aug 2001 14:39:44 Brian Compton replied:
Thanks, I'll give it a shot. I really need to take a class on .asp. I'm self taught so far and there are a lot of areas I need help in. Thanks again.

Reply to this topic