Solved

How do I refresh a database / datagrid at runtime?

Posted on 2007-11-23
6
179 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

 

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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

726 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