Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Saving from VFP to SQL on 2 tables
Message
From
03/06/2005 01:41:18
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Saving from VFP to SQL on 2 tables
Miscellaneous
Thread ID:
01019681
Message ID:
01019681
Views:
80
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
Map
View

Click here to load this message in the networking platform