Solved

datagridview loading and unloading based on non binding sql queries

Posted on 2014-09-22
3
353 Views
Last Modified: 2014-09-23
I have a datagridview1 where I load it with a sql statement and I used datagridview1.datasource =nothing then clear and clearselection This will clear the datagridview1  I repopulate the datagridview comes up with 2 records for every 1 record if I run it a third time the datagridview comes up 3 times for that 1 record is there a way to just havethe datagridview just load data once I assume the dataset is not being destroyed. That's another thing if a user selects a certain team that dataset I cannot change. How do I release a dataset and repopulate it
0
Comment
Question by:powerztom
3 Comments
 
LVL 8

Expert Comment

by:Ganapathi
ID: 40338372
What statement you used for this "datagridview1.datasource =nothing then clear"? Can you post your code snippet?
0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 500 total points
ID: 40338683
Do you reinitialize the datatable/dataset as well? Add following before your .Fill method call

YourDataTableName = New DataTable

or

YourDataSetName = New DataSet
0
 

Author Closing Comment

by:powerztom
ID: 40339247
CodeCruiser:, Thank You  I'm Happy now I can use this in more places in project.
0

Featured Post

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.

Question has a verified solution.

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

Suggested Solutions

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

832 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