Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
BEGIN Transaction
Message
From
08/10/1999 02:08:25
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
BEGIN Transaction
Miscellaneous
Thread ID:
00274085
Message ID:
00274085
Views:
71
Hi,
I am using BEGIN TRASACTION to update multiple table in a process as the following: (my tables are set buffering - 5)

>INSERT INTO Topup (Trans_No, Card_ID, Topup_Amount, Topup_DateTime) ;
VALUES (lcTrans_No, lcCard_ID,
>BEGIN TRANSACTION
>lnUpdated = TABLEUPDATE(.T.,.T.,'Topup', laError)
>IF lnUpdated
>SELECT Member
>REPLACE Total_Sum WITH Total_Sum + lnTopup ;
Balance WITH lcTotal
>ELSE
>ROLLBACK
>= TABLEREVERT(.T.)
>RETURN
>ENDIF
**Read and Process CommPort Data/****
>IF ReadComm() = "Failed"
>ROLLBACK
>= TABLEREVERT(.T.)
>RETURN
>ELSE
>END TRANSACTION
>ENDIF

My question are:
1. If any of my process above failed, will the tabled REVERTED without error? I used to get error TABLEREVERT() is not supported for TRANSACTION. However, the example is help file do so too... Therefore I tried to write =TABLEREVERT(.T.) a few spaces in front of rollback as the following:
>>>>>>>ROLLBACK
>>>=TABLEREVER(.T.)
It works OK alreadi, is it really OK for these code?

2. If there is error that need the update process to be reverted by my procedure (e.g. readcomm failed), I failed to TABLEREVERT(.T.) it. I will get .F. if I update the same record again with ReadComm Successfully even. It caused by the uniqueness of primary key. But I have already issued TABLEREVERT()!!!

3. I got error "Data session #2 could not released without end transaction". What is the mistake? I will get this if I revert my table and quit.

Thank you
I am not the most powerful man in this world.
I am not the worst man in this world either.
I just as same as all of you.
I still need to learn from my mistakes...
Next
Reply
Map
View

Click here to load this message in the networking platform