Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copying Rows For New Order Entry Detail

Status
Not open for further replies.

Auguy

Programmer
May 1, 2004
1,206
US
I can't seem to work this out and I'm sure I'm missing something basic. I have an order entry form with the detail of the order in a grid tied to a dataset. I want to be able to "copy" this order and the detail to start a new order. The table(SQL) has an identity field. Do I have to add each row manually? Can someone give me a generic set of steps to get this done? All attempts up to this point result in the previous order's detail records being changed to the new order.

Auguy
Sylvania, Ohio
 
Auguy,

I'm not quite sure what it is you are doing, but if you have orders in a datagrid that is bound to a datset, you can add as manys rows as you like. Once you have added your order you could you a SQLDataAdapter and create the Update and Inserts methodes>

SqlDataAdapter1.Update(yourDS, "table")

If you set the Update and insert methods correctly the SQLDataadapter will do the rest. However there are serveral ways you can update tables but I find this the best way
 
The problem is I'm not sure if there is a way to tell the dataset that these are new rows for the new order without losing the original rows for the previous orders when the table gets updated. I guess i can copy the rows and fields one at a time, but there must be a better approach. Is there a way to change the identity column so the update command considers them new records. The bottom line is I need to preserve the current order detail that is displayed on the screen and copy the detail for the new order and preserve the original data, and then display the new order detail in the same grid/dataset. Hope this makes some sense

Auguy
Sylvania, Ohio
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top