Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Server transactions and VFP
Message
 
 
To
24/06/2011 10:13:01
General information
Forum:
Visual FoxPro
Category:
Client/server
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Desktop
Miscellaneous
Thread ID:
01515853
Message ID:
01515855
Views:
78
>I am confused as to the manner in which cursor adapters operate in relation to transactions in a VFP9 SP2 front end /SQL Server back end.
>I issue the T-SQL Begin transaction command and then set the transactions to manual. Then I start saving to each individual table with an insert to the cursor adapter and then a tableupdate. The tableupdates always return succes, then I issue the T-SQL commit transaction command, followed by the setting of transactions to automatic.
>Yet, when I check the SQL tables, nothing was saved. I create the cursor adapters with the optimistic table buffering setting (5).
>Example of what I do:
>sqlexec(nHandle,'BEGIN TRANSACTION')
>sqlsetprop(nHandle,'Transactions',2) && manual
>insert into cursoradapter1....
>lOK = tableupdate(.t.,.t.,'cursoradapter1')
>if lOK
> insert into cursoradapter2
> lOK = tableupdate(.t.,.t.,'curadapter2')
>endif
>if lOK
> sqlcommit(nhandle)
>else
> sqlrollback(nHandle)
>endif
>sqlsetprop(nHandle,'Transactions',1) && automatic
>However, nothing gets saved to the SQL Tables
>
>Why?

I use CA with SQL Server and the transactions pretty much as you do. And I have not experience the problem you described. Could it be that
1. Your CA property AllowUpdate is not set to .T.
2. Do your tables have PK field?

HTH.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Reply
Map
View

Click here to load this message in the networking platform