Transactions with VFP & SQL SERVER 
Author Message
 Transactions with VFP & SQL SERVER

Hi,

   What is the best way to handle transaction processing in VFP using
SQL Server 7.0 ?  I currently have it set so that I BEGIN TRANSACTION
followed by TABLEUPDATE(2) and then an END TRANSACTION.  But... what
happenes if I have to rollback the changes I just made cause some
subsequent update fails and I need to get rid of the first record in the
relationship?  I've tried ROLLBACK and TABLEREVERT but neither one will
undo the changes made at the server, evern though localy my remote view
seems as though it's been reversed.  I know that I have the
SQLROLLBACK() command but I need a connection number for this to work,
and since I'm using remote views I don't know what the connection #
would be.  Am I going about this the wrong way?  Any advise would be
much appreciate.  I'm knee deep in SQL hell for the first time in my
life and I'm drowning!

Thanks,
Renato Da Conceicao
Seabridge International Shipping Inc.



Sun, 13 Jan 2002 03:00:00 GMT  
 Transactions with VFP & SQL SERVER

Quote:
>Hi,

>   What is the best way to handle transaction processing in VFP using
>SQL Server 7.0 ?  I currently have it set so that I BEGIN TRANSACTION
>followed by TABLEUPDATE(2) and then an END TRANSACTION.  But... what
>happenes if I have to rollback the changes I just made cause some
>subsequent update fails and I need to get rid of the first record in the
>relationship?

You need to set transactions to manual for that connection

SQLSETPROP(lnConnectionID, "Transactions", DB_TRANSMANUAL)

(DB_TRANSMANUAL in in Foxpro.h)

You can get the connection ID from the cursor
e.g. lnConnectionID = CURSORGETPROP("ConnectHandle", "CursorName")

Then by beginning an update you start a transaction which will not be
commited until you issue a SQLCOMMIT(lnConnectionID).

Hope that helps,

Regards,

Mark



Tue, 15 Jan 2002 03:00:00 GMT  
 Transactions with VFP & SQL SERVER
IF you use Pass Throu. you must :
= SQLEXEC(lnConnectionID, "BEGIN TRANSACTION")
and so..
= SQLEXEC(lnConnectionID, "COMMIT TRANSATION") or SQLEXEC(lnConnectionID,
"ROLLBACK TRANSATION")

--
Best regards, Aleksey Klimov, MCSE


Quote:

>>Hi,

>>   What is the best way to handle transaction processing in VFP using
>>SQL Server 7.0 ?  I currently have it set so that I BEGIN TRANSACTION
>>followed by TABLEUPDATE(2) and then an END TRANSACTION.  But... what
>>happenes if I have to rollback the changes I just made cause some
>>subsequent update fails and I need to get rid of the first record in the
>>relationship?

>You need to set transactions to manual for that connection

>SQLSETPROP(lnConnectionID, "Transactions", DB_TRANSMANUAL)

>(DB_TRANSMANUAL in in Foxpro.h)

>You can get the connection ID from the cursor
>e.g. lnConnectionID = CURSORGETPROP("ConnectHandle", "CursorName")

>Then by beginning an update you start a transaction which will not be
>commited until you issue a SQLCOMMIT(lnConnectionID).

>Hope that helps,

>Regards,

>Mark



Fri, 22 Feb 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Begin - End Transaction & SQL Server

2. VFP w/ SQL Server 6.5 - transactions question

3. Controlling SQL Server transactions in VFP6

4. SQL Server Transactions

5. VFP 6.0, SQL Server 7.0, & Identity Fields

6. VFP 6 SP3 & SQL Server 7

7. VFP 5.0 & SQL Server ROLLBACK

8. VFP & SQL Server - ADO or ODBC

9. VFP & SQL Server TimeStamps

10. VFP & SQL Server - ADO or ODBC

11. VFP & SQL server join

12. HELP - VFP 3.0 & SQL Server connectivity

 

 
Powered by phpBB® Forum Software