• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 187
  • Last Modified:

How do I refresh a database / datagrid at runtime?

I have a datagridview control on my form which is connected to a database. I have a button on my form which executes a stored procedure against the table which is a NonQuery procedure.

Everything works fine, but the datagridview on the screen does not reflect the current state of the database until I close the program and restart it.

Is there any way to refresh the grid so to speak while the program is running?
0
BIGZIPZ1
Asked:
BIGZIPZ1
  • 3
  • 3
1 Solution
 
Ashish PatelCommented:
You will need to recall the sub routine or function after the procedure is ran which fills your datagrid or else refresh the entire form.
0
 
BIGZIPZ1Author Commented:
I tried "Form1.JackBennyTableAdapter.Fill(Form1.LibraryDataSet.JackBenny)" to fill the form again and the old data remained.

I also tried "Form1.Refresh" to and it stayed.
0
 
Ashish PatelCommented:
after this Form1.JackBennyTableAdapter.Fill(Form1.LibraryDataSet.JackBenny) try rebinding the adapter to datagrid and try.
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
BIGZIPZ1Author Commented:
"try rebinding the adapter to datagrid and try."

I am not sure how to do this.
0
 
Ashish PatelCommented:
How do to apply data adapter to data grid, that is binding. Try refreshing the data adapter and refill it.
0
 
BIGZIPZ1Author Commented:
The TableAdapter control doesn't have a refresh command.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now