PC Review Forums Newsgroups Microsoft DotNet Microsoft ADO .NET dataTable.Clear()

Reply

dataTable.Clear()

 
Thread Tools Rate Thread
Old 24-12-2006, 08:26 AM   #1
goldie11
Guest
 
Posts: n/a
Default dataTable.Clear()


Hi,

I would like to remove all the rows of a DataTable - but not by using a
loop through all the DataRows - but by using a single command.
I tried - dataTable.Clear() which is supposed to remove all rows of the
dataTable - but it doesn't seem to work - the table is still full.

Any idea?

Thanks you all.

  Reply With Quote
Old 24-12-2006, 11:54 AM   #2
Jesús López
Guest
 
Posts: n/a
Default Re: dataTable.Clear()

Please, can you elaborate on "but it doesn't seem to work" ?. Based on my
experience, DataTable.Clear() works fine and as expected ...

Regards,

Jesús López



"goldie11" <ruthie_fy@yahoo.com> escribió en el mensaje
news:1166948793.051707.125700@79g2000cws.googlegroups.com...
> Hi,
>
> I would like to remove all the rows of a DataTable - but not by using a
> loop through all the DataRows - but by using a single command.
> I tried - dataTable.Clear() which is supposed to remove all rows of the
> dataTable - but it doesn't seem to work - the table is still full.
>
> Any idea?
>
> Thanks you all.
>



  Reply With Quote
Old 25-12-2006, 09:51 AM   #3
diego
Guest
 
Posts: n/a
Default Re: dataTable.Clear()

Hi,

try using:

datatable.rows.clear()

hth

Ayon kay goldie11:
> Hi,
>
> I would like to remove all the rows of a DataTable - but not by using a
> loop through all the DataRows - but by using a single command.
> I tried - dataTable.Clear() which is supposed to remove all rows of the
> dataTable - but it doesn't seem to work - the table is still full.
>
> Any idea?
>
> Thanks you all.


  Reply With Quote
Old 25-12-2006, 01:01 PM   #4
Cor Ligthert [MVP]
Guest
 
Posts: n/a
Default Re: dataTable.Clear()

Diego,

Are you sure that this clears the columns as well?

Cor

"diego" <diegobph@yahoo.com> schreef in bericht
news:1167040317.175017.178110@79g2000cws.googlegroups.com...
> Hi,
>
> try using:
>
> datatable.rows.clear()
>
> hth
>
> Ayon kay goldie11:
>> Hi,
>>
>> I would like to remove all the rows of a DataTable - but not by using a
>> loop through all the DataRows - but by using a single command.
>> I tried - dataTable.Clear() which is supposed to remove all rows of the
>> dataTable - but it doesn't seem to work - the table is still full.
>>
>> Any idea?
>>
>> Thanks you all.

>



  Reply With Quote
Old 25-12-2006, 05:16 PM   #5
RobinS
Guest
 
Posts: n/a
Default Re: dataTable.Clear()

He could use datatable.reset -- this returns the datatable
to its original, uninitialized state.

Robin S.
-----------------------------
"Cor Ligthert [MVP]" <notmyfirstname@planet.nl> wrote in message
news:OD2P2RCKHHA.2140@TK2MSFTNGP03.phx.gbl...
> Diego,
>
> Are you sure that this clears the columns as well?
>
> Cor
>
> "diego" <diegobph@yahoo.com> schreef in bericht
> news:1167040317.175017.178110@79g2000cws.googlegroups.com...
>> Hi,
>>
>> try using:
>>
>> datatable.rows.clear()
>>
>> hth
>>
>> Ayon kay goldie11:
>>> Hi,
>>>
>>> I would like to remove all the rows of a DataTable - but not by
>>> using a
>>> loop through all the DataRows - but by using a single command.
>>> I tried - dataTable.Clear() which is supposed to remove all rows of
>>> the
>>> dataTable - but it doesn't seem to work - the table is still full.
>>>
>>> Any idea?
>>>
>>> Thanks you all.

>>

>
>



  Reply With Quote
Old 26-12-2006, 08:54 AM   #6
diego
Guest
 
Posts: n/a
Default Re: dataTable.Clear()

Cor,

the op said he only wanted to clear the rows, not the columns as well.

Diego

Ayon kay Cor Ligthert [MVP]:
> Diego,
>
> Are you sure that this clears the columns as well?
>
> Cor
>
> "diego" <diegobph@yahoo.com> schreef in bericht
> news:1167040317.175017.178110@79g2000cws.googlegroups.com...
> > Hi,
> >
> > try using:
> >
> > datatable.rows.clear()
> >
> > hth
> >
> > Ayon kay goldie11:
> >> Hi,
> >>
> >> I would like to remove all the rows of a DataTable - but not by using a
> >> loop through all the DataRows - but by using a single command.
> >> I tried - dataTable.Clear() which is supposed to remove all rows of the
> >> dataTable - but it doesn't seem to work - the table is still full.
> >>
> >> Any idea?
> >>
> >> Thanks you all.

> >


  Reply With Quote
Old 26-12-2006, 01:23 PM   #7
Cor Ligthert [MVP]
Guest
 
Posts: n/a
Default Re: dataTable.Clear()

Yea,

But datatable.clear as Jesus wrote should do that fine, therefore we should
in my idea wait on the answer on that, can be interesting..

Cor

"diego" <diegobph@yahoo.com> schreef in bericht
news:1167123250.623399.325410@48g2000cwx.googlegroups.com...
> Cor,
>
> the op said he only wanted to clear the rows, not the columns as well.
>
> Diego
>
> Ayon kay Cor Ligthert [MVP]:
>> Diego,
>>
>> Are you sure that this clears the columns as well?
>>
>> Cor
>>
>> "diego" <diegobph@yahoo.com> schreef in bericht
>> news:1167040317.175017.178110@79g2000cws.googlegroups.com...
>> > Hi,
>> >
>> > try using:
>> >
>> > datatable.rows.clear()
>> >
>> > hth
>> >
>> > Ayon kay goldie11:
>> >> Hi,
>> >>
>> >> I would like to remove all the rows of a DataTable - but not by using
>> >> a
>> >> loop through all the DataRows - but by using a single command.
>> >> I tried - dataTable.Clear() which is supposed to remove all rows of
>> >> the
>> >> dataTable - but it doesn't seem to work - the table is still full.
>> >>
>> >> Any idea?
>> >>
>> >> Thanks you all.
>> >

>



  Reply With Quote
Old 27-12-2006, 12:04 PM   #8
nil
Guest
 
Posts: n/a
Default Re: dataTable.Clear()


Cor Ligthert [MVP] wrote:
> Yea,
>
> But datatable.clear as Jesus wrote should do that fine, therefore we should
> in my idea wait on the answer on that, can be interesting..
>
> Cor
>
> "diego" <diegobph@yahoo.com> schreef in bericht
> news:1167123250.623399.325410@48g2000cwx.googlegroups.com...
> > Cor,
> >
> > the op said he only wanted to clear the rows, not the columns as well.
> >
> > Diego
> >
> > Ayon kay Cor Ligthert [MVP]:
> >> Diego,
> >>
> >> Are you sure that this clears the columns as well?
> >>
> >> Cor
> >>
> >> "diego" <diegobph@yahoo.com> schreef in bericht
> >> news:1167040317.175017.178110@79g2000cws.googlegroups.com...
> >> > Hi,
> >> >
> >> > try using:
> >> >
> >> > datatable.rows.clear()
> >> >
> >> > hth
> >> >
> >> > Ayon kay goldie11:
> >> >> Hi,
> >> >>
> >> >> I would like to remove all the rows of a DataTable - but not by using
> >> >> a
> >> >> loop through all the DataRows - but by using a single command.
> >> >> I tried - dataTable.Clear() which is supposed to remove all rows of
> >> >> the
> >> >> dataTable - but it doesn't seem to work - the table is still full.
> >> >>
> >> >> Any idea?
> >> >>
> >> >> Thanks you all.
> >> >

> >



to clear rows of the datatable use
datatable.rows.clear
and it works fine and to clear columns use
datatable.columns.clear
and it will work

Thanks & Regards,
Nil
"Problem is just the distance between the expectation and the reality"

  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off