>>>>Hi,
>>>>
>>>>I am creating a procedure in the VFP 9 application that will Cascade update of all FK values in child tables when user changes the value of unique field in the parent table. What I do is set "transactions" to 2 (via SQLSETPROP) and then update Parent table and then Child Tables. But I get error that the update conflicts with the Foreign Key constraint set in the SQL Server on a Child table. I thought that the "transaction" will take care of it. So is there a way to get around this? Is there a way to make SQL Server ignore the constraints until the Transaction is finished? Any other suggestions? TIA.
>>>
>>>I suggest to use SQL Server transactions, e.g.
>>>
>>>BEGIN TRANSACTION
>>> UPDATE Parent
>>> UPDATE Child
>>>COMMIT TRANSACTION
>>
>>I think I found where I was mistaken.
>>
>>UPDATE: Nope. I added SQLEXEC( nHandle, "BEGIN TRANSACTION") but it does nothing. :(
>
>It should start explicit transactions. What do you mean by it does nothing?
It does nothing because as soon as I call SQLEXEC( nHandle, "Update Child") I get error of the constraint conflict. If transaction worked, I would not get the error. That is, the data would be updated on Commit but it does not.
"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