split event handler or fire event as two events
-
hello all... i have logical trouble in my windows application there is one eventHandler (Button1_click) contains two sqlcommands the first sqlcommand insert into parent table (primary key table) the second sqlcommand insert into references table as expected the code generate sql exception because the referial constraint the question is : how to solve this problem without adding new eventHandler and without modifying the tables relation? best regards
-
hello all... i have logical trouble in my windows application there is one eventHandler (Button1_click) contains two sqlcommands the first sqlcommand insert into parent table (primary key table) the second sqlcommand insert into references table as expected the code generate sql exception because the referial constraint the question is : how to solve this problem without adding new eventHandler and without modifying the tables relation? best regards
You have to return the newly created ID's from the first insert and update your data before sending the second insert. A better solution may be to parcel the whole data set up as xml, pass it into a stored procedure, then you can process the whole lot in one shot.
If you have knowledge, let others light their candles at it. Margaret Fuller (1810 - 1850) www.JacksonSoft.co.uk
-
hello all... i have logical trouble in my windows application there is one eventHandler (Button1_click) contains two sqlcommands the first sqlcommand insert into parent table (primary key table) the second sqlcommand insert into references table as expected the code generate sql exception because the referial constraint the question is : how to solve this problem without adding new eventHandler and without modifying the tables relation? best regards
The application shouldn't know or care about the details; all that should be handled in the Data Access Layer.