Display error page when Database is down

Results 1 to 2 of 2

Thread: Display error page when Database is down

  1. #1
    Join Date
    Dec 1969

    Default Display error page when Database is down

    I would like to display an error page when my database is down. The database is SQL server 7. Here is what my code looks like:<BR><BR>&#060;%<BR>on error resume next<BR> <BR> dim objconn<BR> set objconn = Server.CreateObject("ADODB.Connection")<BR> objConn.ConnectionString = "DSN=xx; Uid=xx; Pwd=xx;"<BR> objconn.open<BR> <BR> if connerror(objconn) = true then<BR> response.redirect "/error.html"<BR> end if <BR> <BR>function connerror(objconn)<BR>connerror = false<BR> dim objerror<BR> if objconn.errors.count &#062; 0 then<BR> connerror = true<BR> end if <BR>end function <BR>%&#062;<BR><BR>I just read in my Wrox book that each time an ADO command is run if an error is encountered the errors collection is cleared and filled with the new details. But if no errors occur then the collection is not touched. This tells me why my code does not work. Anyone know how to successfully accomplish this? Any help would be appreciated.

  2. #2
    Join Date
    Dec 1969

    Default Simpler...

    &nbsp;<BR>objConn.Open sConStr<BR><BR>If objConn.State &#060;&#062; adStateOpen then<BR> &#039; you&#039;ve got a problem<BR>end if<BR><BR>If you don&#039;t have the ADO constants in your global.asa,<BR>then put this at the top of the global.asa file:<BR><BR>&#060;!--METADATA NAME="Microsoft ActiveX Data Objects 2.6 Library" TYPE="TypeLib" UUID="{00000206-0000-0010-8000-00AA006D2EA4}"--&#062;<BR><BR> or<BR><BR>&#060;!--METADATA NAME="Microsoft ActiveX Data Objects 2.5 Library" TYPE="TypeLib" UUID="{00000205-0000-0010-8000-00AA006D2EA4}"--&#062;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts