Information générale
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
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 .
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement