Multi-table Insert Problem -
01-25-2007
, 10:54 PM
Here's the problem:
Using VS2005, 3 tables in a dataset linked hierarchically, stored externally
on SQL server.
When the update occurs, the identity of the first table gets cascaded to the
second table. The foreign key is then cascaded to the third table
correctly. But when the insert on the third table is generated, the
parameter for the primary key is not set to the correct value.
The datatables in the dataset look like this before the inserts,
T1 id=-1
T2 id=-1,line=1
T3 id=-1,line=1,subline=1
After the T1 insert,
T1 id=367
T2 id=367,line=1
T3 id=367,line=1,subline=1
T2 insert works fine. On the T3 insert when looking at the profile and the
command sent to SQL server, the @id=-1 not the expected @id=367.
Moving the values to the @parameters happens under the sheets. Does anyone
have any idea what could be going wrong?
Thanks,
MikeMOD |