Announcement

Collapse
No announcement yet.

problems with db error

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

  • 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 ?






  • #2
    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.

    Comment


    • #3
      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.

      Comment


      • #4
        Re: problems with db error

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

        Comment


        • #5
          Re: problems with db error

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

          Comment


          • #6
            i also facing the same issue. Did you solve this issue ?
            Thanks

            Comment

            Working...
            X