Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Begin Transaction command in VFP and SQL
Message
From
01/10/2004 01:07:28
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Begin Transaction command in VFP and SQL
Miscellaneous
Thread ID:
00947828
Message ID:
00947828
Views:
208
Hi guys,

I trying to implement the BEGIN TRANSACTION in both VFP & SQL 2000, the code is listed below.


begin transaction
SQLExec( nConn, 'BEGIN TRANSACTION' )
* Update changes to biophysicalrv remote view.
lEverythingOK = tableupdate( 2, .F., 'biophysicalrv' )
if lEverythingOK
* Update changes to itemsrv.
lEverythingOK = tableupdate( 2,.F.,'itemsrv')
endif

lEverythingOK = .F. && I placed this code to tell the program that it needs to roll back the transactions.

* End the transaction on the server and VFP.
If lEverythingOK
SQLExec( nConnection, 'IF @@TRANCOUNT > 0 COMMIT' )
end transaction
else
SQLExec( nConnection, 'IF @@TRANCOUNT > 0 ROLLBACK' )
rollback
Endif

The problem here is that it does not work. Even if the VFP Transaction and Sql Transactions were rolled back to their original state, the changes were still committed to the database.

Did I missed something?

Any Idea?
Thanks in advance
Music Rocks www.musicreserve.blogspot.com
Success is 1% Inspiration & 99% Perspiration
God Sometimes Delays His Help to Test Our Faith and Energize Our Prayers
Our Boat May Be Tossed While He Sleeps, But He Wakes Up Before it Sinks.
Next
Reply
Map
View

Click here to load this message in the networking platform