Solved

How do I refresh a database / datagrid at runtime?

Posted on 2007-11-23
6
178 Views
Last Modified: 2008-02-01
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
Comment
Question by:BIGZIPZ1
  • 3
  • 3
6 Comments
 
LVL 23

Accepted Solution

by:
Ashish Patel earned 500 total points
ID: 20339785
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
 

Author Comment

by:BIGZIPZ1
ID: 20339843
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
 
LVL 23

Expert Comment

by:Ashish Patel
ID: 20339881
after this Form1.JackBennyTableAdapter.Fill(Form1.LibraryDataSet.JackBenny) try rebinding the adapter to datagrid and try.
0
VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

 

Author Comment

by:BIGZIPZ1
ID: 20339976
"try rebinding the adapter to datagrid and try."

I am not sure how to do this.
0
 
LVL 23

Expert Comment

by:Ashish Patel
ID: 20340030
How do to apply data adapter to data grid, that is binding. Try refreshing the data adapter and refill it.
0
 

Author Comment

by:BIGZIPZ1
ID: 20340067
The TableAdapter control doesn't have a refresh command.
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SQL Server: SNAPSHOT replication to include a newly added table. 2 30
Addition to SQL for dynamic fields 6 47
Sql Server group by 10 44
location of a form 2 25
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question