Solved

How do I refresh a database / datagrid at runtime?

Posted on 2007-11-23
6
177 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

by Mark Wills Attending one of Rob Farley's seminars the other day, I heard the phrase "The Accidental DBA" and fell in love with it. It got me thinking about the plight of the newcomer to SQL Server...  So if you are the accidental DBA, or, simp…
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

803 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