Refreshing DataGridView, once and for all!

S

Sin Jeong-hun

Hello.
What I'm trying to do is to reload data from an MDB file to a
DataGridView. First of all, I'd searched for "refresh datagridview",
there were many previous questions, but I couldn't really find any
working solution.

Here are the conditions:
1.There is an MDB file, which has a table named "Posts".
2.Visual Studio automatically generated various classes
like ...tableAdator,...dataSet, ...bindingSource.
3.Another program changes the MDB.
4.I want to reload data from the MDB file and show it on the
DataGridView!

If the DataGridView could automatically reflects changes to the MDB,
it would be great, but they said that is possible due to disconnected
nature or something.
So, I just added a "Refresh" button, and try to let the user refresh
the view manually. Looked like quite a simple task, but I couldn't
really find a solution. Somebody said some code like the following
worked, but it doesn't work!
postsDataSet.GetChanges();
postsTableAdapter.Fill(this.postsDataSet.Posts);

For God's sake, would you please give me the right code to simply
reload data from the MDB file to the DataGridView? I've wasted a lot
of time trying to solve this. Thank you for reading.
 
S

Simon Duvall

That's just terrible that you haven't gotten the right code from other
people yet. ;>

Without seeing the code you've used, it's hard to say what needs fixing. If
changes have been made to the data, you'd need something like
postsTableAdapter.Update(this.postsDataSet) or
postsTableAdapter.Update(this.postsDataSet.Posts) to commit the data, then
try the refresh.

~simon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top