Commit and rollback examples.

Posted by Admin on 20-Jun-2011 08:10

1.       Please Write me  a block of code which inserts data in database, (Use sports db) When end of record is reached, it ask the user wants to commit or not. If yes then commit all the records otherwise rollback all the changes.

All Replies

Posted by Tim Kuehn on 20-Jun-2011 08:29

commit / rollback are sql-isms and don't apply to ABL code.

Posted by rohit.ramak on 20-Jun-2011 08:52

DEFINE VARIABLE cState  AS CHARACTER LABEL "State : "   NO-UNDO.

FOR FIRST Customer NO-LOCK :

    ASSIGN cState = Customer.State.
    UPDATE cState.

    MESSAGE 'Do you want to update this value to Db ?'
        VIEW-AS ALERT-BOX QUESTION BUTTONS YES-NO UPDATE v_answer AS LOGICAL.
    IF v_answer = TRUE THEN
    DO:
        /*
          refeth same record or a buffer in EX-Lk and do update here
        */
    END.
END.

Posted by Admin on 22-Jun-2011 06:31

since i am a beginner.

i did not get what to refetch in the do: end block.

can u help me.

Posted by rohit.ramak on 22-Jun-2011 08:26

Refee to Progress handbook and/or help pages for the keywords "FIND" /  "DEFINE BUFFER" / "FIND-CURRENT" and work through the examples you find there.

Posted by gus on 22-Jun-2011 08:40

Enough. You really should spend some time studying the documentation references that you have been given. We should not have to do your homework for you and you do nothing at all for yourself. You are equipped with a brain. Put it to work.

Posted by Admin on 22-Jun-2011 22:48

hi gus,

ya i m studying at this time and i have done other assignments on dyanamic temp tables, dyanamic Query, dyanamic browsers and working with XML by myself. I have only posted the questions releated to transaction and other basics, cause i was absent on this lecturres other i am doing well. i am also not only trying my own code but also this forums gives me a knowledge on how to optimize the codes also.

so another good point  is that the forums will give me to share my thoughts with the others intelligent people like you.

so thank u.

This thread is closed