• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 184
  • 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

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