I\'m trying to create a refresh button to automatically refresh the data inside my datagridview after i have finish updating them.
However, my refresh button doesn\'
I had a datagridview, bound to a table in an Entity Framework database:
dataGridView1.DataSource = MyDatabase.MyTable;
It would never refresh despite two wasted days. I solved it with a simple workaround:
private void button_refresh_Click(object sender, EventArgs e) {
dataGridView1.DataSource = MyDatabase.MyTable.Where(i =>(true));
}
This is an ugly workaround, and friend explained me how it works - if I do just dataGridView1.DataSource = database.table
, it will cache the table and use the cached data forever. The fact that each time we create a new dummy query, prevents .net from caching it.