[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

MSg in ASP page when the database is down?

Posted on 2004-11-02
3
Medium Priority
?
255 Views
Last Modified: 2010-04-17
Hi all

   I have a page which displays details fetched from my oracle database which is in another server and connected thru a DSN. But sometimes if my datasbe server is phisically down, i am getting an erro msg " Microsoft oledb database...". I need to display a proper error msg when this is happing. How do I do thru ASP coding. Pleas ehelp me.
Thansk in advance.
Rags
0
Comment
Question by:rgvn
1 Comment
 
LVL 2

Accepted Solution

by:
Panadmin earned 200 total points
ID: 12480078
Turn on error handling, and check the value of Err.Number. If an error occurs then write a message using Response.Write.
An example using ADO:

<%
on error resume next
'<-- Insert your own database access code here.
'      set oRS = Server.CreateObject("ADODB.Recordset")
'      oRS.Open storedProc, connectionString
If Err.Number <> 0 then
    Response.Write "The server cannot be reached. Please try again later."
    Response.End
End If
%>

Instead of writing the message directly on the data access page, and ending the response, you could send your client to a separate page, using Response.Redirect "pageURL" or Server.Transfer "pageURL". That page could be a simple html page that you reference for this sort of error throughout your application.


0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
Simple Linear Regression
Loops Section Overview

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question