Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQLEXEC supported commands
Message
From
05/05/2011 19:18:03
Joel Leach
Memorial Business Systems, Inc.
Tennessee, United States
 
 
To
05/05/2011 09:17:15
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01509605
Message ID:
01509761
Views:
54
>Hi All,
>
>We are looking to perform transaction protection against a remote VFP database. We are using cursor adapters and so the data source can flip between SQL Server and a VFP DBC. We wrote a program to loop through the connection handles that we wish to protect and then issue the BEGIN TRANSACTION command and then during the save process we fire the END TRANSACTION or COMMIT (depending on data source) it the TABLEUPDATE was succeesful or issue a ROLLBACK if it fails. This works just fine when SQL Server is the backend data, but when the commands are issued against a DBC the BEGIN TRANSACTION fails with a 42000 - Syntax Error or Access Violation. I received that with another command that I used that was unsupported by the ODBC driver, but moving to an ADO call against the VFPOLEDB driver fixed that one. Not so lucky this time. Does anyone have any ideas?
>
>In its simplest form the calls look like this:
>nHandle = SQLSTRINGCONNECT("Driver={Microsoft Visual FoxPro Driver};SourceType=DBC;SourceDB=C:\database.dbc")
>lnRet = SQLEXEC(nHandle,"BEGIN TRANSACTION")
>

According to http://support.microsoft.com/kb/150149, the VFP ODBC driver supports transactions. Try using manual transaction processing: SQLSetProp(nHandle,"Transactions", 2), SQLCommit(), and SQLRollback() instead of sending commands. Maybe that will help?
Joel Leach
Microsoft Certified Professional
Blog: http://www.joelleach.net
Previous
Reply
Map
View

Click here to load this message in the networking platform