views:

2130

answers:

2

i wanted to make a simple data entry application. So i did the following

  • Created a new Windows Form Application
  • Added a DataGridView
  • Added a new DataSource (SQL Express Database, having a single table with 3 columns - id, name, number) id is integer and is the primary key
  • As the designer automatically populates the DataSet, BindingSource and TableAdapter i ran the application.

when i ran the application it showed the existing data, and i was able to add new data by clicking on empty row or edit existing data. But it did not store (commit) the data for me.

After i make the changes i just close the application. I remember doing it some time ago and it used to reflect changes. Do i have to add any code to commit the changes?

+1  A: 

Insert Update Delete using datagrid

Shoban
i checked that, and if you have read my requirement i wanted it compeltely in design mode without writing additional code. If you drag and drop the dataset on to the form you can see it does all that without any additional code, why can't that be achieved.
Anirudh Goel
+2  A: 

A dataset is (by definition) disconnected. If you want to commit new data / updates / deletes (etc), you are going to have to ask the adapter to save the changes. If you already have a generated adapter, this should be about 1 line of extra code... (Update on the adapter, usually via a save button's Click handler).

Marc Gravell