DataGridView Update

后端 未结 3 1786
甜味超标
甜味超标 2021-01-24 15:32

I\'m using 2005 Windows Forms in C#. I\'ve only been working at this for a day, so go easy please.

I\'d like to have a submit button that saves changes to a DataGridVie

3条回答
  •  攒了一身酷
    2021-01-24 16:20

    Sam,

    the update needs a table so you could try something like:

    TableType table = (TableType) stagingGrid.DataSource;
    myStagingTableAdapter.Update(table);
    

    where you'll have to substitute TableType with something appropriate.

    But a better approach would be to use drag-and-drop and learn form the code.

    1. Select Data|View Datasources. Your dataset should be visible in the DataSources Window.
    2. Drag a table to a (new) form. VS2005 will add a load of components and a few lines of code.

    The form will now have a instance of the dataset and that is your reference point for Adapter.Fill and .Update methods.

提交回复
热议问题