Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

datagridview loading and unloading based on non binding sql queries

Posted on 2014-09-22
3
Medium Priority
?
367 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
[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 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 2000 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

Give Your Engineering Team a Productivity Boost

Learn why container technology is so powerful and how it can provide your team with productivity gains and other benefits.

Question has a verified solution.

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

It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
Windocks is an independent port of Docker's open source to Windows.   This article introduces the use of SQL Server in containers, with integrated support of SQL Server database cloning.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

722 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