Announcement

Collapse
No announcement yet.

problems with db error

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • vivo1
    started a topic problems with db error

    problems with db error

    I tried this in OnAfterInsert event
    //after the insert of a new record into the table behind the form I use the following code in order to insert a new record into an another table...

    sc_exec_sql(insert into tb....);
    sc_error_continue("insert") ;

    if (!empty({sc_error_insert})) {
    sc_rollback_trans();
    sc_error_message({sc_error_insert});
    sc_error_exit();
    //sc_redir(form_appl,"_parent");
    }
    else {
    sc_commit_trans();
    }

    Unfortunately when the error occur it seems that my code is not executed.The application show the error in a page white and is not possible to redirect or exit.

    What can I do to manage the DB error in SC ?






  • ashdev805
    replied
    i also facing the same issue. Did you solve this issue ?
    Thanks

    Leave a comment:


  • vivo1
    replied
    Re: problems with db error

    yes , I started with sc_begin_trans() in OnValidateSuccess event but nothing.

    Leave a comment:


  • AntonioGarcia
    replied
    Re: problems with db error

    Try to use the macro Sc_begin_trans in the start of the code.

    Leave a comment:


  • vivo1
    replied
    Re: problems with db error

    I cannot to move OnBeforeInsert the code because the insert sql use as foreign key the primary key generated in insert event.Are two table linked but not in a form master-detail.

    Leave a comment:


  • maxveras
    replied
    Re: problems with db error

    Sir, try to use in OnBeforeInsert, and erase this line 'sc_rollback_trans();'

    Maybe this is the cause of the error.

    Leave a comment:

Working...
X