|
-
Aug 30th, 2008, 08:51 AM
#1
Re: How to combine Insert and Updates?
First up, don't ask the same question in multiple threads. If you wanted to shift the discussion from the Database Development forum to the VB.NET forum then you should have asked a moderator to move the thread.
As to the question, why would you need two Buttons anyway? You just put all your data into a DataTable and call Update on the DataAdapter. That will execute the adapter's InsertCommand on all the DataRows with a RowState of Added and the UpdateCommand on all the DataRpws with a RowState of Modified. One method call, ergo one Button, to save all the data.
-
Aug 30th, 2008, 12:14 PM
#2
Thread Starter
Addicted Member
Re: How to combine Insert and Updates?
 Originally Posted by jmcilhinney
First up, don't ask the same question in multiple threads. If you wanted to shift the discussion from the Database Development forum to the VB.NET forum then you should have asked a moderator to move the thread.
As to the question, why would you need two Buttons anyway? You just put all your data into a DataTable and call Update on the DataAdapter. That will execute the adapter's InsertCommand on all the DataRows with a RowState of Added and the UpdateCommand on all the DataRpws with a RowState of Modified. One method call, ergo one Button, to save all the data.
Sorry about the asking same questions part...next time I will ask a moderator.
So Ive put both the quoted Insert and Update commands in a single button. but the insert still trying to insert when I am just trying to update the @quantityRequested. The update IS working, but the insert is STILL trying to insert as well, which throws up the error "Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index". For @bookingsID parameter.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|