My error is not being trapped

Results 1 to 4 of 4

Thread: My error is not being trapped

  1. #1
    Tarquin Guest

    Default My error is not being trapped

    &#060;%On Error Resume Next %&#062;<BR>&#060;%<BR> Dim isiteno<BR> isiteno = Session("sitenumber")<BR> &#039;test for errors<BR> If Err.Number &#060;&#062; 0 OR db.errors.count &#060;&#062; 0 Then<BR> Response.Redirect "error.asp"<BR> End If<BR> &#039;open site table<BR> Dim RSsite, SQL1<BR> SQL1 = "SELECT * FROM site WHERE site_no = " & isiteno <BR> Set RSsite = Server.CreateObject("ADODB.RecordSet")<BR> RSsite.Open SQL1, objConn, , , adCmdText<BR>%&#062;<BR>The code above is intended to re-direct the user to an error page if the session has timed out.<BR>This is not happening - the recordset set is being created with no records as isiteno no longer exists.<BR>Can anyone help please ?

  2. #2
    Join Date
    Dec 1969

    Default RE: My error is not being trapped

    OR db.errors.count &#060;&#062; 0 what is this doing there?<BR><BR>remove it and see

  3. #3
    Join Date
    Dec 1969

    Default RE: My error is not being trapped

    Not sure, but I think that the results from your assignment would result in the value NULL instead of an error if they have timed out.. Try checking for <BR><BR>if isiteno = NULL or isiteno = "" then<BR> errorr...<BR>end if

  4. #4
    Eddie Campbell Guest

    Default RE: My error is not being trapped

    If I understand you, what you are trying to do is see if Session("sitenumber") is empty as a result of the session timing out. Well, an empty Session variable won&#039;t raise an error, so your error testing will never find one. You could try putting the error test AFTER the recordset is opened, or better still, do this instead<BR><BR>isiteno = Session("sitenumber")<BR>If isiteno = "" Then<BR> Response.Redirect "error.asp"<BR>End If<BR><BR><BR>

Posting Permissions

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