Saving two DataTables, with Parent - Child relation
Posted on 2006-06-05
simple scenario : I have two tables, tblOrders and tblOrdersDetails. tblOrders hold generic order info, and tblOrdersDetails hold all items related to this order.
columnare as follow: tblOrders : OrderID (identity, autonumber) and column Customer (nvarchar)
in the tblOrdersDetails, the columns are : ItemID(identity, autonumber) and column OrderID (int) wich I want to be equal to the OrderID form tblOrders.
Now when dealing with DataTables, how do I get an order to save to the tblOrders, and then all records that are saved to the tblOrdersDetails, I want them to have the previously generated Identity filed in their column OrderID ?
Any help please, very urgent to complete this.