VBAHole22 Posted November 26, 2003 Posted November 26, 2003 I see many samples online where you pull a dataset from a database and make some changes and then call update to reunite the changes that were made. What I would like to do is call the update and have all of the records in the dataset appended into the database. But my dataset originates from outside of the session. I have a web service that passes a dataset in to a win app. I know that the structure of this dataset is identical to the structure of my db. So the flow would be: Receive dataset from web service send dataset to the db for append I can't figure out how to do this because all of the update code I see is predicated on having a select statement first to pull the records. I don't need to pull records I just want to Insert Into. I would like to aviod setting up a loop and going through each record and calling an INsert SQL statement, but if someone has code for that I'll give it a try. Quote Wanna-Be C# Superstar
*Experts* Nerseus Posted November 26, 2003 *Experts* Posted November 26, 2003 The DataAdapter handles updating the database. Assuming you have the commands setup correctly, the DataAdapter does an INSERT, UPDATE, or DELETE based on the status of each row. If you're pulling records from a source, they're likely marked "unmodified" so using a DataAdapter wouldn't work. You'll have to get them marked as "added" in the dataset, then the DataAdapter will try to insert them. Take a look at the InsertCommand of the DataAdapter. -Nerseus Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.