Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem with SQL Transactions
Message
 
 
To
17/10/2001 12:06:55
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00569686
Message ID:
00573468
Views:
21
I don't know about transactions but code certanly can be simplified
If sqlsetprop ( connobj.handle, “TRANSACTIONS”, 2 ) 
  llOk = tableupdate ( 2, .f., “VPREDIOS” ) ;
        AND tableupdate ( 2, .f., “VHISCRED” ) ;
        AND tableupdate ( 2, .f., “VRECIBOS” ) ;
        AND tableupdate ( 2, .f., “VDRECIBOS” ) 
  IF llOk
    * commit transactions
    connobj.commit
  else
    connobj.rollback
  endif
endif
sqlsetprop ( connobj.handle, “TRANSACTIONS”, 1 )
>Actually we are developing a SQL application with a VFP Front End. In this application I use both remote views and SQL pass trough (SPT). To use SPT I develop a object named CONNOBJ that execute instructions, scripts, etc. I observe all the system works fine except for the manual transactions. I have a form using 4 remote views and I want to save to SQL server but using transactions. This is my code:
>If sqlsetprop ( connobj.handle, “TRANSACTIONS”, 2 ) then
>  If tableupdate ( 2, .f., “VPREDIOS” ) then
>     If tableupdate ( 2, .f., “VHISCRED” ) then
>        Wait “Transaction Tests “ window
>        If tableupdate ( 2, .f., “VRECIBOS” ) then
>           If tableupdate ( 2, .f., “VDRECIBOS” ) then
>              * commit transactions
>              connobj.commit
>           else
>               * rollback transactions
>               connobj.rollback
>           endif
>        else
>           connobj.rollback
>        endif
>     else
>       connobj.rollback
>     endif
>  else
>     connobj.rollback
>  endif
>else
>    connobj.rollback
>endif
>sqlsetprop ( connobj.handle, “TRANSACTIONS”, 1 )
>I test my CONNSQL object outside of my program and the transactions works fine !!!. But when use in my form don’t work!!!. I try SQLSETPROP ( 0, …. ) and DBSETPROP() but still don´t work. For testing I disconnect my PC from the network between the TABLEUPDATE() instructions and I observe that SQL SERVER update my first tables without receiving the SQLCOMMIT.
>
>Any Suggestions???
>
>Sincerely and sorry for my bad english
>
>Ing. Edmundo Rios Miranda
>Estrategias Computacionales, SA de CV
>Cuernavaca, Morelos, México
>Escom@infosel.net.mx
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform