I have the following code:
The following line is global
Dim sqlDS = New DataSet()
This is in a procedure
objConnect.Open()
sqlDA = New SqlDataAdapter("select * from
eventCalendar",objConnect)
sqlDA.Fill(sqlDS,"eventCalendar")
Dim totalRows as integer
Dim totalColumns as integer
Dim GetRows as DataTable =
sqlDS.tables("eventCalendar")
My problem is that when I do the fill, it seems to be appending to
what was in the old Dataset (sqlDS - Since it is global).
I want to clear the sqlDS before I do the fill.
How would I do this?
Thanks,
Tom.
Cor Ligthert - 30 Jun 2004 11:08 GMT
Hi TFS
sqlDS = nothing
or
dim SqlDS as Dataset
and than in your methode
sqlDs = New Dataset
I hope that helps?
Cor
> I have the following code:
>
[quoted text clipped - 23 lines]
>
> Tom.
Laszlo - 30 Jun 2004 11:11 GMT
Hi,
You can sqlDS.Clear()
Or sqlDS=New DataSet(), then you can a totally new DataSet.
Garbage Collector must delete the old DataSet. (I think, it doesn't make
always.)
Laszlo
> I have the following code:
>
[quoted text clipped - 28 lines]
> ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
> ----------------------------------------------------------
Christoph - 30 Jun 2004 11:12 GMT
> My problem is that when I do the fill, it seems to be appending to
> what was in the old Dataset (sqlDS - Since it is global).
> I want to clear the sqlDS before I do the fill.
> How would I do this?
Couldn't you just do:
sqlDS = New DataSet()
right before the fill?
Chris
Miha Markic [MVP C#] - 30 Jun 2004 11:13 GMT
Hi
Try DataSet.Clear method.

Signature
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com
> I have the following code:
>
[quoted text clipped - 28 lines]
> ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
> ----------------------------------------------------------
Cor Ligthert - 30 Jun 2004 11:24 GMT
sh.....t
> Try DataSet.Clear method.
I knew there was something with my answer I did put that extra command in
it.
And did not wanted to check it.
:-)
Cor
JohnFol - 30 Jun 2004 11:36 GMT
Try this
sqlDA = New SqlDataAdapter("select * from eventCalendar",objConnect)
If sqlDS.Tables.Contains("eventCalendar") Then
sqlDS.Tables("eventCalendar").Clear()
sqlDA.Fill(sqlDS,"eventCalendar")
> I have the following code:
>
[quoted text clipped - 28 lines]
> ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
> ----------------------------------------------------------
Earl - 30 Jun 2004 17:42 GMT
If you have a global dataset, you will more likely wish to clear the
datatable within the dataset instead of clearing all tables/all data from
the dataset.
sqlDS.tables("eventCalendar").Clear()
> I have the following code:
>
[quoted text clipped - 28 lines]
> ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
> ----------------------------------------------------------