Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using Transactions from VFP code
Message
 
General information
Forum:
Microsoft SQL Server
Category:
Other
Environment versions
SQL Server:
SQL Server 2005
Miscellaneous
Thread ID:
01546947
Message ID:
01546950
Views:
45
I see. Too bad. I cannot use Cascade Update because SQL Server does allow me to. And yet I cannot cascade from my VFP code. I will have to remove all FK constraints then :(. Thank you.

>You cannot change parent key involved into FK relationship unless you set Cascade Update
>
>>
>>Here is a problem I am having. A parent table has a unique char field (e.g. Custom_ID). The child tables with this field (FK) have FK constraint set on this field. When I edit this field in the parent table (in VFP code) I have a code that would change the value in the parent table and then in all child tables. Before I UPDATE the parent table and any child table I set a transaction as following
>>
>>
>>nRetVal = SQLSETPROP( oApp.conn_handle, "transactions", 2) 
>>
>>
>>Then the code is suppose to update the Parent table first and then each Child table. At the end the SQLCOMMIT() would be called. The problem is that as soon as I update the Parent table I get the error pointing to one of the Child tables REFERENCE constraint. I thought that the Transaction (above) would stop SQL server from updating the tables until commit but apparently it does not work that way. Am I setting the Transaction incorrectly? Or what am I missing?
>>TIA
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Reply
Map
View

Click here to load this message in the networking platform