Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Begin Transaction
Message
 
 
To
28/09/2016 07:24:54
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows 7
Network:
Windows XP
Database:
MS SQL Server
Application:
Desktop
Miscellaneous
Thread ID:
01641395
Message ID:
01641443
Views:
46
Tariq,

As I said to you, you need to run all your SQL code as one batch, .e.g.

text to lcSQLCommand textmerge noshow

begin transaction

delete from ...

insert into ...

commit transaction

endtext

In other words, instead of 3 separate blocks of sqlexec you would use a single command. The transaction must be on SQL Server side, not in VFP side where it has no bearings for your SQL Server and serves no purpose.

Try to change your code yourself the way I am suggesting to you, post the result here for our inspection, then proceed.



>>Your BEGIN TRANSACTION/END TRANSACTION has no effect for SQL Server and should not be used.
>>
>>What is the exact purpose of your code? Can you tell in English what are you trying to achieve? I think you can perform all operations as one long command rather than doing 3 separate SQL commands.
>>
>
>
>Dear Naomi Nosonovsky
>
>According to my knowledge, BEGIN TRANSACTION/END TRANSACTION is a set of codes which passes commands. It works like electrical switch ON or OFF. If TRANSACTION is completed then all commands in BEGIN TRANSACTION/END TRANSACTION works others wise fail or rollback.
>
>If connection fails with server during BEGIN TRANSACTION/END TRANSACTION then all is rollback like Insert,delete etc.
>
>
>So I use code like this
>
>BEGIN TRANSACTION
>
>Delete voucher
>Insert voucher
>
>END TRANSACTION
>
>
>If I do not use BEGIN TRANSACTION/END TRANSACTION and powere goes after DELETE VOUCHER then Insert commad will not run.
>In case of useing BEGIN TRANSACTION/END TRANSACTION, powers goes on connection fails then all will be rollback.
>
>May be my knowledge about BEGIN TRANSACTION/END TRANSACTION is wrong. If yes then please help how to modify my codes in a better way.
>
>Thanks in advacne
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform