You could show your code instead of explaining it, you know.
As you don't I have to make some assumptions.
Hopefully you have a
DataSet[
^], or
DataTable
, as your data layer and then you use a
DataAdapter[
^] as a bridge between your database and the
DataSet
. See also
Populating a DataSet from a DataAdapter[
^]
Then you should use a
BindingSource[
^] between the DataSet and your
DataGridView[
^]. This makes it easier to filter the data and connect the data members to your Windows Form components.
To update or insert data when a value in the
DataGridView
is change you can use the event
DataGridView.OnCellValueChanged[
^].
Inside the event you can now check if the
DataRow
is new or changed and you can take the proper action to either insert or update the data. Here you can also use the
DataAdapter
, see
Updating Data Sources with DataAdapters[
^]
So, this was a long answer, but as you are not showing what you have done there is no other way.