A little ugly, but you might get away with writing a stored procedure that takes a parameter with is the SQL to execute, and putting the transaction commands around it:
LPARAMETERS cSQLEXEC
BEGIN TRANSACTION
&cSQLEXEC
ENDTRANSACTION
and executing the stored procedure instead of the SQL directly. I haven't tried this personally so it might not work but it seems logical to me.
If you try this please let me know if it works correctly.
>>We've got a C/S app that can use various back ends, depending on the client's environment. Among the back ends supported is VFP. In this configuration we use the VFP ODBC driver to connect to the VFP DBC at the back end from our VFP app on the front end.
>>
>>This has worked fine, but now we're adding transaction processing with a new module. After establishing a connection handle with SQLCONNECT(), sending the SQLEXEC(nhandle,"BEGIN TRANSACTION") command always returns -1. The same code works for SQL Server and Oracle via ODBC, but not for VFP.
>>
>>Can anyone shed light on what's happening here?
>
>Hi Alan!
>
>How's things going??
>
>I believe that transactions are not supported through VPF ODBC. It works in Oracle and SQL Server because the database natively supports transactions. This isn't the case with VFP.
Eric Shaneson
Cutting Edge Consulting