Updating SQL Server using Table adapters

Jan 25 2006 11:32 AM

In a C# 2.0 application a have a dll:

I have a strongly typed dataset with to tables in a parent/child relationship. I am adding a row to the parent table like this:

this.insertedHistPosRunHeadRow = histPosSoldDs.HistPOSRunHead.AddHistPOSRunHeadRow(<table values param list>);

the returned row is used as the first input parameter for the child table:

this.insertedHistSoldHeadRow = histPosSoldDs.HistSoldHead.AddHistSoldHeadRow(this.insertedHistPosRunHeadRow,<table values param list>);


To update the database I am using the table adapter update method.

For the parent table: histPosRunHeadTableAdapter.Update(histPosSoldDs.HistPOSRunHead);                            

histPosSoldDs.HistPOSRunHead.AcceptChanges();

For the child table:
histSoldHeadTableAdapter.Update(histPosSoldDs.HistSoldHead);
histPosSoldDs.HistSoldHead.AcceptChanges();

The result are that the parent table is added to the SQL Server database, but the child table never gets inserted.

I have debugged the dataset and are seeing that the FK constraint are updating the child table's foreign key correctly.

Does anyone have experiencing the same and/or have a solution that can help me further on the way here?

Thanks, Harald