I have timer-function. It handles data from sql database every N time (it's doesn't matter actually what time). The subsequent algorithm does not work. Or I don't know how to make it work.
- I put data into Dataset.
const string query = "SELECT id FROM SomeTable LIMIT 100";
await using var cmd = new MySqlCommand(query, connection);
var sqlAdapter = new MySqlDataAdapter(cmd);
sqlAdapter.TableMappings.Add("Table", "SomeTable");
sqlAdapter.Fill(_mapping);
_mapping.AcceptChanges();
Where _mapping is dataset.
- If this is the first filling of the dataset, then just fill it.
If this is not the first filling, then try to update the data in it. I tried to use
sqlAdapter.Update(_mapping). But it doesn't update any data Or I cant get updated data. I tried fill it again and check_mapping.hasChanges(DataRowState.Modified | DataRowState.Added))But it hasn't any changes.
So how can I fill dataset and catch changed or added rows while I get data from Database? Or may be I need to use another things like dataTable or something else?