G
Guest
Hi,
I have an application that was working fine since last two months but all of
a sudden it stopped working!!!
This is what I do in my code:
(1) Open the connection
(2) Start the transaction and get the SQLTransaction object
(3) Call ProcedureA to insert the parent record and get the newly generated id
(4) Call ProcedureB to insert the child record and pass that procedure the
parent id generated in step 3.
and boom! the following error occurs:
INSERT statement conflicted with COLUMN FOREIGN KEY constraint 'p_p_fk2'.
The conflict occurred in database 'MyDB', table 'ChildTable', column
'parent_id'.\r\nThe statement has been terminated."
Looks like the 2nd procedure call does not see the newly generated id; it
should see the id b/c both of the procedures are being run under the same
transaction! since it does not see the id, hence I am thinking may be
procedure are not running under the same transaction for some reason or may
be some server setting changed last night which is causing this problem!
Please note that the code has been working fine since last two months and
stopped working all of a sudden!
Can you guys think of anything that would have triggered this behavior.
Please help.
Thanks,
Mansoor Siddiqui
I have an application that was working fine since last two months but all of
a sudden it stopped working!!!
This is what I do in my code:
(1) Open the connection
(2) Start the transaction and get the SQLTransaction object
(3) Call ProcedureA to insert the parent record and get the newly generated id
(4) Call ProcedureB to insert the child record and pass that procedure the
parent id generated in step 3.
and boom! the following error occurs:
INSERT statement conflicted with COLUMN FOREIGN KEY constraint 'p_p_fk2'.
The conflict occurred in database 'MyDB', table 'ChildTable', column
'parent_id'.\r\nThe statement has been terminated."
Looks like the 2nd procedure call does not see the newly generated id; it
should see the id b/c both of the procedures are being run under the same
transaction! since it does not see the id, hence I am thinking may be
procedure are not running under the same transaction for some reason or may
be some server setting changed last night which is causing this problem!
Please note that the code has been working fine since last two months and
stopped working all of a sudden!
Can you guys think of anything that would have triggered this behavior.
Please help.
Thanks,
Mansoor Siddiqui