Some time ago I asked in this forum and in others on the correct way to use transactions in a client/server scenario (VFP vs SQL Server). Some people gave me pointers, advice and even examples, but I was consistently facing a problem that had me perplexed.
Until today, after many tests, I made a breakthrough and found the solution. This is the scenario: I use cursor adapters to handle remote data access via ODBC With ODBC it is much easier to program and it requires less effort. It is useful in LAN situations and if one does not work with tiers. All the literature consulted and the advice received tell me that transactions should be set to manual, then save the different tables and finally set the transactions back to automatic. And reading all the literature one understands why, Following the examples on books and white papers I used to do this: #define DB_TRANSMANUAL 2 #define DB_TRANSAUTO 1 sqlexec(nHandle, 'BEGIN TRANSACTION') SQLSetProp(nHandle, "TRANSACTIONS", DB_TRANSMANUAL) *** save the different tables and then SQLSetProp(nHandle, "TRANSACTIONS", DB_TRANSAUTO) However, in tests where I purposefuly introduced an error, the thing did not work. The tables prior to the error would be saved and the ones to be saved after the error would not. Which made the routine very insecure and defeated the whole purpose of transaction programming. Today I did two things: a) set the cursor adapter USETRANSACTIONS property to .F., so the CA would not handle transactions automatically. b) instead of using de DEFINED variables as above, send the numbers 2 and 1 directly like so: SQLSetProp(nHandle, "TRANSACTIONS",2) and SQLSetProp(nHandle, "TRANSACTIONS",1) And of course, in this way it worked. And I have to add that using SPT the problem was the same and was solved as above. The first case is because I should have RTFM in the first place. My bad... But the second case, using numbers instead of precompiled variables, baffles me. Is it a problem with the ODBC driver? I use Windows 7 Ultimate and SQL Server 2008 Express RS 2 If anybody has the answer, I will appreciate it. Rafael Copquin _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/[email protected] ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

