SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: Error Handling

  1. #1
    SitePoint Wizard billy_111's Avatar
    Join Date
    Jul 2009
    Posts
    1,683
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Error Handling

    Hey everyone,

    I have the following code:

    Code:
      On Error Resume Next 
     
       SET COM=SERVER.CREATEOBJECT("ADODB.COMMAND") 
       COM.ACTIVECONNECTION=CONN 
       COM.COMMANDTIMEOUT=600 
     
       'Execute the SQL 
       com.commandtext = "SET NOCOUNT ON SET DATEFORMAT DMY "&SQL 
       Set Rec = Com.Execute 
     
       'When the Error is not 0  
       If Err.number <> 0 Then   
            Message = "<h4><strong>Warning:</strong> An error occured during this database transaction. <br /><br />" 
            Message = Message & Err.Description & "</h4>" 
             
            If rDebug = 1 Then 
                Message = Message & "<br /><h5>Database query: " & SQL & "</h5>" 
            End If 
     
            Err.Clear 
            Response.Write (Message) 
            Response.End 
       End If    
     
       On Error Goto 0
    This successfully gets out errors for me perfectly. ("SQL" is the SQL query in question)

    But the problem is that i cannot get the line number out, i tried Err.Number but that gave me a negative number?

    How can i achieve this?

    Kind regards,
    Software Engineer ASP, ASP.NET, VB, PHP

    Kind regards
    Billy

  2. #2
    SitePoint Addict itHighway's Avatar
    Join Date
    Jan 2008
    Location
    GUJ
    Posts
    270
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you mean that it does not show the line number where error occur then On Error Statement does not support any line number function.


Bookmarks

Posting Permissions

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