Solved

C#: Updating DataSet with data from DataGrid to execute DataAdapter.Update.

Posted on 2007-04-02
3
1,286 Views
Last Modified: 2013-11-07
I have crated a dataset from one table of an Access database which I'm using to populate a datagrid. I have setup the UpdateCommand and InsertCommand properties of the DataAdapter and have tested the insert functionality by programatically adding a row to the DataSet and executing the DataAdapter.Update method. This worked fine.

The bit I'm a bit confused about (as simple as I'm sure it is) is the logic of how to get updated or new rows from the DataGrid get update to the database. In one of the many articles I just read, of which none explicitly explain this detail, I saw mention of the fact that the DataGrid will automatically update the DataSet? From my brief experience of .NET, this doesn't make sense. I would assume I have to use an event from the datagrid to update the dataset.

Could someone let me know what event I should use, and how I can incorporate the data from the DataGrid into the DataSet. For some reason I just can't find any references on how to do this. Probably just too tired.
0
Comment
Question by:Esulin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 

Author Comment

by:Esulin
ID: 18836478
I'm in a bit of a hurry so bumping up the points.
0
 
LVL 21

Expert Comment

by:theGhost_k8
ID: 18836738
if u just want to refill the grid with new data, just assign ds to grid's datasource after you add it to DB.
obv. you should refill the ds as well before assigning.
0
 
LVL 21

Accepted Solution

by:
theGhost_k8 earned 500 total points
ID: 18836810
0

Featured Post

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question