General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Saving from VFP to SQL on 2 tables
Hy everyone !
I have a VERY big problem at saving records in 2 parent-child tables .
VFP interface and SQL server. In VFP a DBC with remote views with default values and rules on fields .
The problem is that if the SQL server returns an error on the child table, the parent behaves
like fields were modified , so filed rules are triggered and executed. And I can't have that .
The algorithm is:
*****************
BEGIN TRANSACTION
IF !(TABLEUPDATE(.f.,.f.,'invoices') AND TABLEUPDATE(.t.,.f.,'details')
=AERROR(laerror)
thisform.error(laerror[1],laerror[2],lineno(1))
ROLLBACK
=SQLROLLBACK(lconnhandle)
=SQLSETPROP(lconnhandle,"Transactions",1)
RETURN .F.
ENDIF
IF SQLCOMMIT(lconnhandle)<0
=aerror(laerror)
thisform.error(laerror[1],laerror[2],lineno(1))
ROLLBACK
=SQLROLLBACK(lconnhandle)
=SQLSETPROP(lconnhandle,"Transactions",1)
RETURN .F.
ENDIF
END TRANSACTION
=SQLSETPROP(lconnhandle,"Transactions",1)
Thank you very much,
Any help will be appreciated
Mihai .
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only