dataset does not clear

  • Thread starter Thread starter douglas
  • Start date Start date
D

douglas

I have a Visual Basic.net 2005 dataset in a desktop application does not
clear out even after I do a dispose on the object. What could cause this
problem? Ho can I empty the dataset?

I am writing a desktop windows Visual Basic.net 2005 desktop application
that generates one excel spreadsheet per unique customer. I run the dispose
method on the dataset object so that I can obtain the data for the next
customer I will populate data on the next spreadsheet. Howver when I update
the data on a new excel spreadsheet for the next customer, the data from the
previous customer appears on the spreadsheet also.
Thus can you tell me what I can do and/or what I need to check for to make
certain the data from the previous customer in the dataset is cleared out?
 
Hello Douglas,
I have a Visual Basic.net 2005 dataset in a desktop application does
not clear out even after I do a dispose on the object. What could
cause this problem? Ho can I empty the dataset?

I am writing a desktop windows Visual Basic.net 2005 desktop
application
that generates one excel spreadsheet per unique customer. I run the
dispose
method on the dataset object so that I can obtain the data for the
next
customer I will populate data on the next spreadsheet. Howver when I
update
the data on a new excel spreadsheet for the next customer, the data
from the
previous customer appears on the spreadsheet also.
Thus can you tell me what I can do and/or what I need to check for
to make
certain the data from the previous customer in the dataset is cleared
out?

Instead of dispose, call clear. Or even better yet, use a fresh dataset.
 
"Jesse Houwing":

I have used dispose and clear and this does not work.

How do you use a fresh dataset? Would I have a 'fresh' data set empty in
memory and set the old dataset = to the new dataset?
Whatever your solution is, can you show code on how to get a 'fresh'
dataset preferably in vb.net.

How do you copy one dataset to another dataset?

Thanks
 
Hello Douglas,
"Jesse Houwing":

I have used dispose and clear and this does not work.

You shouldn't use Dispose. Clear should do the job. If it doesn't, then you
have something strange going on. Can you share the code that is working with
this dataset? It's much easier to help you if we can actually see what you've
written.
How do you use a fresh dataset? Would I have a 'fresh' data set
empty in
memory and set the old dataset = to the new dataset?

Yes that's about what I meant. It's usually a little harder than just setting
a new dataset. Depending on how your form is set up, you might need to redo
the databindings and/or set up your events properly.
Whatever your solution is, can you show code on how to get a 'fresh'
dataset preferably in vb.net.

x = new DataSet()

That's all there is to it :)
How do you copy one dataset to another dataset?

Using DataSet.Merge you can copy data from one dataset to another.

Kind regards,

Jesse Houwing
 
I saw that you got all your answers from Douglas and Scott in this and in
the newsgroup dotnet.languages.vb (I don't know where you did post this
more).

Will you please be so kind not to multipost, as you are able to that then
use a newsreader to crosspost (sending one messages to all newsgroups).

Multiposts makes helping terrible difficult.

Cor
 
Back
Top