Javascript version of "On error resume next"

Results 1 to 2 of 2

Thread: Javascript version of "On error resume next"

  1. #1
    Scott Moore Guest

    Default Javascript version of "On error resume next"

    Hi,<BR><BR>I&#039m opening my db, which is working fine, but I need to code, in case the db is down or for some reason the user cannot connect to the db. I&#039m using JavaScript, instead of VBScript (inside ASP). Is there an equivalent to "On error resume next". I&#039ll need to check if the open() failed. Here is my code<BR><BR> Session("objConn") = "";<BR> Session("objRS") = "";<BR> Session("objConn") = Server.CreateObject("ADODB.Connection");<BR> Session("objConn").ConnectionString = "DSN=CCPR;uid=sa"<BR> Session("objConn").Open();<BR> <BR> if (Session("objConn").Errors.Count &#062; 0)<BR> {<BR> // An error ocurred trying to connect to the database<BR> Session("m_db_error") = "true"<BR> }<BR><BR>Thanks,Scott

  2. #2
    Join Date
    Dec 1969

    Default RE: Javascript version of

    You have to use the try / catch syntax for JScript error handling. Check out:<BR><BR><BR>This is Microsoft&#039s documentation on the try / catch syntax.<BR><BR>Happy Programming!

Posting Permissions

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