473,387 Members | 1,771 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

DataSet not Clearing

Dan
I have a C# form with an OleDBconnection, adaptor and
dataset along with a several text boxes linked to the
Dataset and 2 buttons. I am assigning the dataset to a
DataGrid.

My problem:
I enter a date into a text box and use this as a variable
into a parameterized SQL statement. Click a button and
the SQL works great...populates Dataset and Grid.
Problem:
Now I enter a new date in the text field and click the
button to regenerate this SQL and it APPENDS the data to
the dataset and Datagrid. I would like this to be cleared
and only contain the results of the new query.

Thanks in advance - Dan

Nov 15 '05 #1
3 1722
Dan <an*******@discussions.microsoft.com> wrote:
I have a C# form with an OleDBconnection, adaptor and
dataset along with a several text boxes linked to the
Dataset and 2 buttons. I am assigning the dataset to a
DataGrid.

My problem:
I enter a date into a text box and use this as a variable
into a parameterized SQL statement. Click a button and
the SQL works great...populates Dataset and Grid.
Problem:
Now I enter a new date in the text field and click the
button to regenerate this SQL and it APPENDS the data to
the dataset and Datagrid. I would like this to be cleared
and only contain the results of the new query.


Well, you could call DataSet.Clear() yourself just before doing the
query. That's probably the easiest way of doing things.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 15 '05 #2

myDataset.Clear();
myDataadpter.Fill(myDataset);

"Dan" <an*******@discussions.microsoft.com> schrieb im Newsbeitrag
news:06****************************@phx.gbl...
I have a C# form with an OleDBconnection, adaptor and
dataset along with a several text boxes linked to the
Dataset and 2 buttons. I am assigning the dataset to a
DataGrid.

My problem:
I enter a date into a text box and use this as a variable
into a parameterized SQL statement. Click a button and
the SQL works great...populates Dataset and Grid.
Problem:
Now I enter a new date in the text field and click the
button to regenerate this SQL and it APPENDS the data to
the dataset and Datagrid. I would like this to be cleared
and only contain the results of the new query.

Thanks in advance - Dan

Nov 15 '05 #3
Dan
Thanks guys. I will give this a try.
-----Original Message-----

myDataset.Clear();
myDataadpter.Fill(myDataset);

"Dan" <an*******@discussions.microsoft.com> schrieb im Newsbeitragnews:06****************************@phx.gbl...
I have a C# form with an OleDBconnection, adaptor and
dataset along with a several text boxes linked to the
Dataset and 2 buttons. I am assigning the dataset to a
DataGrid.

My problem:
I enter a date into a text box and use this as a variable into a parameterized SQL statement. Click a button and
the SQL works great...populates Dataset and Grid.
Problem:
Now I enter a new date in the text field and click the
button to regenerate this SQL and it APPENDS the data to the dataset and Datagrid. I would like this to be cleared and only contain the results of the new query.

Thanks in advance - Dan

.

Nov 15 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Mojtaba Faridzad | last post by:
Hi, I am a newbie! I am wondering how DataSet keeps the data. I am using MySQL as database engine. when I use "Fill" method to set a table in DataSet, does C# retreive all data (base on Select...
5
by: Nita | last post by:
Hi, Im a sort of newbie when it comes to VB.NET, so forgive me if this is a simple question. I have a dataset i wish to clear, ive used a parameterised stored procedure from MS Access. Currently...
0
by: Hubert | last post by:
Hi I created XmlDataDocument synchronized with DataSet. everythingi is grat until I need to clear all data from it. I've tried Reset(), Clear(), RemoveChild etc. but nothing works. The only way I...
3
by: Cub71 | last post by:
Is it possible to use dataset.Clear(); dataAdapterSomething.Update(dataset.table); to clear a table in an SQL database? I am not able to get this to work. The dataset clears, but the...
7
by: polecat | last post by:
Im new to .NET and I am having probs with this Every time I reload the form the same data is repeated again.... Done reading on msdn and another forum cant figure out why the...
0
by: Chris | last post by:
Hello, I have a problem with re-loading datasets. As a simple example, if I have an SQL table of addresses comprising active and inactive addresss, I wish to load either sub-set by clicking on...
8
by: cj | last post by:
I have a program to display queries to a SQL db. I type my query in a textbox and click a button and the results display in a datagrid. I could use either dataset or datatable to read the data in...
0
by: tshad | last post by:
I am trying to clear my dataset each time I read a new csv file but it seems to keep the data from the previous time. If I do:...
1
by: sweetiecakes | last post by:
Hi I have a ListBox which is binded to a dataSet. When I need to refresh this dataSet, it works, but the old entries don't get removed from the listbox. Items.Clear() doesn't work when a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.