nRetVal = SQLSETPROP( oApp.conn_handle, "transactions", 2) IF nRetVal < 0 RETURN .F. ENDIF IF nRetVal > 0 nRetVal = SQLEXEC( oApp.conn_handle, "Update MyTable1 SET MyField1 = '123' WHERE MyField1 = 'ABC"" ) ENDIF SUSP && run code for second vfp IF nRetVal > 0 nRetVal = SQLEXEC( oApp.conn_handle, "Update MyTable2 SET MyField1 = '123' WHERE MyField1 = 'ABC"" ) ENDIF IF nRetVal < 0 SQLROLLBACK(oApp.conn_handle) ELSE SQLCOMMIT(oApp.conn_handle) ENDIF- second vfp
nRetVal = SQLSETPROP( oApp.conn_handle, "transactions", 2) IF nRetVal < 0 RETURN .F. ENDIF IF nRetVal > 0 nRetVal = SQLEXEC( oApp.conn_handle, "Update MyTable1 SET MyField1 = '123' WHERE MyField1 = 'ABC"" ) ENDIF SUSP IF nRetVal > 0 nRetVal = SQLEXEC( oApp.conn_handle, "Update MyTable2 SET MyField1 = '123' WHERE MyField1 = 'ABC"" ) ENDIF IF nRetVal < 0 SQLROLLBACK(oApp.conn_handle) ELSE SQLCOMMIT(oApp.conn_handle) ENDIF2) You can change field validation for field MyField1 or trigger for table
>*-- oApp.conn_handle is the Connection Handle number obtained when application connects to the SQL Server. > >nRetVal = SQLSETPROP( oApp.conn_handle, "transactions", 2) > >IF nRetVal < 0 > RETURN .F. >ENDIF > >IF nRetVal > 0 > nRetVal = SQLEXEC( oApp.conn_handle, "Update MyTable1 SET MyField1 = '123' WHERE MyField1 = 'ABC"" ) >ENDIF > >IF nRetVal > 0 > nRetVal = SQLEXEC( oApp.conn_handle, "Update MyTable2 SET MyField1 = '123' WHERE MyField1 = 'ABC"" ) >ENDIF > >IF nRetVal < 0 > SQLROLLBACK(oApp.conn_handle) >ELSE > SQLCOMMIT(oApp.conn_handle) >ENDIF > >nRetVal = SQLSETPROP( oApp.conn_handle, "transactions", 1) > >>