I have a DataGridView
that displays data from a MS Access database. I'm using a DataSet
with a TableAdapter
and a BindingSource
to link the data to the DataGridView
:
tableAdapter = new AccountsTableAdapter();
dataTable = new Accounts.AccountsDataTable();
tableAdapter.Fill(dataTable);
tableBindingSource = new BindingSource();
tableBindingSource.DataSource = dataTable;
dataGridView1.DataSource = tableBindingSource;
I want to know how can I detect or get notified when the database table gets modified from outside my application - row updates, inserts, deletes performed on the database from the Access interface or from a different app.
Also, upon this presumed notification, how can I update my DataSet so that only the affected rows should be updated -> receive only the newly inserted rows, the affected field values of the modified ones and the indexes of the deleted.
So, basically, what I'm trying to obtain is a way of synchronizing my database table with the DataGridView
. I've already managed to save to the database the rows that I modify or insert in the DataGridView
, now it would be nice to be able to perform the reciprocal side of this database - view binding.