0

I have an app written in c#. Records from the DB are shown through the auto-generated visual studio code (DataTableAdapter).

this._______tTableAdapter.Fill(this._______SQLDataSet._______);

Now, when I make changes to the DB, not through the DataTableAdaper - but through code on another winform, close it and open another where I have my DataTable filled with adapter, the changes are not shown until I restart my app. I don't get it, I tryed closing the window using this.Close() and this.Dispose() to release all the resources, so the next time I open it, the code should rebind the new data from the database, but that's not the case... What am I doing wrong? Thanks very much for any anwser...

Andrej
  • 351
  • 2
  • 6
  • 12
  • So basically the problem is that the `DataGridView` displaying the data is not refreshing? – dandan78 Nov 23 '10 at 08:26
  • yep.. been googleing for a while, the closest anwser i could find was to change the "Copy To Output Directory" property of the database to "Copy If Newer".. but that didn't solve the problem.. – Andrej Nov 23 '10 at 08:31

2 Answers2

0

Have you tried explicitly calling DataGridView.Rows.Clear() when you are loading the form?

If that doesn't work, load the form in debug mode, and look at the status of the data every step of the way.

Yaakov Ellis
  • 40,752
  • 27
  • 129
  • 174
0

My suggestion/comment may not meet your conditions, but referring to this problem, notice, that you can also modify data in DataSet (not passing the calculations on the server witch every change). If all changes are made - you can call Update method on data adapter which provide data updates for all changed rows. Anyway - if you want only refresh changes made in other instance - just refrech DataGridView or set DataSource again.

Przemysław Michalski
  • 9,627
  • 7
  • 31
  • 37