Results 1 to 4 of 4

Thread: @@error in vb6

  1. #1
    Join Date
    Feb 2004
    Location
    lebanon
    Posts
    9

    Question Unanswered: @@error in vb6

    Hi everyone!

    How can I read the value of @@error from within vb6 source? Or how can I check the success of a transaction (comit/rollback) from within vb6 frontend source?

    Thank you!

  2. #2
    Join Date
    Aug 2003
    Location
    Kingston, Ontario
    Posts
    106
    I believe you will have to pass it back as an output parameter from your stored procedure. That's how I do it anyway.

  3. #3
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662
    To capture @@error you can either store its value into an output parameter, or return it in the form of a result set.

    To trap an execution error and notify your FE of a specific section of BE code that encountered the error use RAISERROR. In your VB code precede the call to SQL with ON ERROR (either RESUME NEXT and check for error right below, or GOTO <LABEL> and do the error trapping there).

    EDITED: At the end make sure to turn error-fall-through OFF by issueing ON ERROR GOTO 0. Failure to do so often yields hours of debugging.
    "The data in a record depends on the Key to the record, the Whole Key, and
    nothing but the Key, so help me Codd."

  4. #4
    Join Date
    Aug 2003
    Location
    Kingston, Ontario
    Posts
    106
    ON ERROR GOTO 0. Failure to do so often yields hours of debugging.
    Couldn't agree more. That's why I don't use it. Way too many sleepless nights trying to figure out why the stupid app isn't giving me the results I expect.

    On Error Goto BeerFridge

    Now that works

Posting Permissions

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