Hello.

Working on a VS2005 SP1 Windows form program in .NET 2.0, on XP Pro, SP2.

I have a datatable with no keys and just three columns.

How do you clear a datatable to no rows ?

I tried :

itemsDataTable.Clear()
itemsDataTable.AcceptChanges()


itemsDataTable.Rows.Clear()
itemsDataTable.AcceptChanges()

I can load data into it it, but cannot clear it.

Searching the internet shows it as that simple.

Any help would be gratefully appreciated.

Thanks,
Tony

Re: How do you clear a datatable? by William

William
Fri Mar 16 19:40:09 CDT 2007

DataTable.Clear should remove all rows. There is no need to call
AcceptChanges. What makes you think the local DataTable object has any rows
after you call this method? This will NOT clear the database table--just the
in-memory DataTable object.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------

"Tony Girgenti" <tony(nospam)@lakesideos.com> wrote in message
news:Ojf7K4AaHHA.4948@TK2MSFTNGP05.phx.gbl...
> Hello.
>
> Working on a VS2005 SP1 Windows form program in .NET 2.0, on XP Pro, SP2.
>
> I have a datatable with no keys and just three columns.
>
> How do you clear a datatable to no rows ?
>
> I tried :
>
> itemsDataTable.Clear()
> itemsDataTable.AcceptChanges()
>
>
> itemsDataTable.Rows.Clear()
> itemsDataTable.AcceptChanges()
>
> I can load data into it it, but cannot clear it.
>
> Searching the internet shows it as that simple.
>
> Any help would be gratefully appreciated.
>
> Thanks,
> Tony
>
>



Re: How do you clear a datatable? by Tony

Tony
Fri Mar 16 20:49:54 CDT 2007

Hello Bill.

I am absolutely perplexed and frustated by this whole dataset/database
concept. I thought i understood it, but now i'm totally confused.

I thought a dataset was supposed to be disconnected from the physical
database.

When i look at a datatable properties in the dataset designer, it defines it
as the Items DataTable. If i right click on the Items DataTable in the
Dataset designer and select Preview Data..., and click on the Preview
button, it shows all of the rows. So if i did a itemsDataBase.Clear, why is
the data still there?

When i look at the database in Server Explorer, right click on the Items
table there and click Show Table Data, it shows the same data.

I'm sure that you know way more than i do about this stuff, but i just don't
get it.

Thanks,
Tony

"William (Bill) Vaughn" <billvaRemoveThis@nwlink.com> wrote in message
news:uwyMSzCaHHA.5020@TK2MSFTNGP05.phx.gbl...
> DataTable.Clear should remove all rows. There is no need to call
> AcceptChanges. What makes you think the local DataTable object has any
> rows after you call this method? This will NOT clear the database
> table--just the in-memory DataTable object.
>
> --
> ____________________________________
> William (Bill) Vaughn
> Author, Mentor, Consultant
> Microsoft MVP
> INETA Speaker
> www.betav.com/blog/billva
> www.betav.com
> Please reply only to the newsgroup so that others can benefit.
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
> __________________________________
> Visit www.hitchhikerguides.net to get more information on my latest book:
> Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
> and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
> -----------------------------------------------------------------------------------------------------------------------
>
> "Tony Girgenti" <tony(nospam)@lakesideos.com> wrote in message
> news:Ojf7K4AaHHA.4948@TK2MSFTNGP05.phx.gbl...
>> Hello.
>>
>> Working on a VS2005 SP1 Windows form program in .NET 2.0, on XP Pro, SP2.
>>
>> I have a datatable with no keys and just three columns.
>>
>> How do you clear a datatable to no rows ?
>>
>> I tried :
>>
>> itemsDataTable.Clear()
>> itemsDataTable.AcceptChanges()
>>
>>
>> itemsDataTable.Rows.Clear()
>> itemsDataTable.AcceptChanges()
>>
>> I can load data into it it, but cannot clear it.
>>
>> Searching the internet shows it as that simple.
>>
>> Any help would be gratefully appreciated.
>>
>> Thanks,
>> Tony
>>
>>
>
>



Re: How do you clear a datatable? by RobinS

RobinS
Fri Mar 16 21:11:52 CDT 2007

Because you are clearing the data table in memory, not deleting the records
from the database. If you want to delete the records in the database, you
can ShowTableData in the ServerExplorer on that table, select all the
records, and delete them, or do NewQuery and type in "DELETE FROM
tablename" and execute it.

This is probably explained in Bill's book, by the way. You should check it
out.

Robin S.
--------------------------------
"Tony Girgenti" <tony(nospam)@lakesideos.com> wrote in message
news:%23eEEQaDaHHA.4872@TK2MSFTNGP03.phx.gbl...
> Hello Bill.
>
> I am absolutely perplexed and frustated by this whole dataset/database
> concept. I thought i understood it, but now i'm totally confused.
>
> I thought a dataset was supposed to be disconnected from the physical
> database.
>
> When i look at a datatable properties in the dataset designer, it defines
> it as the Items DataTable. If i right click on the Items DataTable in
> the Dataset designer and select Preview Data..., and click on the Preview
> button, it shows all of the rows. So if i did a itemsDataBase.Clear, why
> is the data still there?
>
> When i look at the database in Server Explorer, right click on the Items
> table there and click Show Table Data, it shows the same data.
>
> I'm sure that you know way more than i do about this stuff, but i just
> don't get it.
>
> Thanks,
> Tony
>
> "William (Bill) Vaughn" <billvaRemoveThis@nwlink.com> wrote in message
> news:uwyMSzCaHHA.5020@TK2MSFTNGP05.phx.gbl...
>> DataTable.Clear should remove all rows. There is no need to call
>> AcceptChanges. What makes you think the local DataTable object has any
>> rows after you call this method? This will NOT clear the database
>> table--just the in-memory DataTable object.
>>
>> --
>> ____________________________________
>> William (Bill) Vaughn
>> Author, Mentor, Consultant
>> Microsoft MVP
>> INETA Speaker
>> www.betav.com/blog/billva
>> www.betav.com
>> Please reply only to the newsgroup so that others can benefit.
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>> __________________________________
>> Visit www.hitchhikerguides.net to get more information on my latest
>> book:
>> Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
>> and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
>> -----------------------------------------------------------------------------------------------------------------------
>>
>> "Tony Girgenti" <tony(nospam)@lakesideos.com> wrote in message
>> news:Ojf7K4AaHHA.4948@TK2MSFTNGP05.phx.gbl...
>>> Hello.
>>>
>>> Working on a VS2005 SP1 Windows form program in .NET 2.0, on XP Pro,
>>> SP2.
>>>
>>> I have a datatable with no keys and just three columns.
>>>
>>> How do you clear a datatable to no rows ?
>>>
>>> I tried :
>>>
>>> itemsDataTable.Clear()
>>> itemsDataTable.AcceptChanges()
>>>
>>>
>>> itemsDataTable.Rows.Clear()
>>> itemsDataTable.AcceptChanges()
>>>
>>> I can load data into it it, but cannot clear it.
>>>
>>> Searching the internet shows it as that simple.
>>>
>>> Any help would be gratefully appreciated.
>>>
>>> Thanks,
>>> Tony
>>>
>>>
>>
>>
>
>



Re: How do you clear a datatable? by pvdg42

pvdg42
Sat Mar 17 09:33:22 CDT 2007


"Tony Girgenti" <tony(nospam)@lakesideos.com> wrote in message
news:%23eEEQaDaHHA.4872@TK2MSFTNGP03.phx.gbl...
> Hello Bill.
>
> I am absolutely perplexed and frustated by this whole dataset/database
> concept. I thought i understood it, but now i'm totally confused.
>
> I thought a dataset was supposed to be disconnected from the physical
> database.
>
> When i look at a datatable properties in the dataset designer, it defines
> it as the Items DataTable. If i right click on the Items DataTable in the
> Dataset designer and select Preview Data..., and click on the Preview
> button, it shows all of the rows. So if i did a itemsDataBase.Clear, why
> is the data still there?
>
> When i look at the database in Server Explorer, right click on the Items
> table there and click Show Table Data, it shows the same data.
>
> I'm sure that you know way more than i do about this stuff, but i just
> don't get it.
>
> Thanks,
> Tony
>
Everything you say about DataTable objects is correct, except for what
happens when you look at DataTable contents in the Dataset Designer. When
you preview data in the designer, the fill() method associated with the
DataTable object executes to show you what the DataTable *will* hold when
filled in your application when it runs. If you execute the Clear() method
in your application, after filling the DataTable, all rows in the DataTable
will be deleted.

Bill has already pointed out that none of the above has any effect on the
actual database table, so when you access the preview from Data Designer
after executing your program, the DataTable is *refilled* with the same data
(from the database) as before.

To test the effects of Clear(), add some code to your app to access the
Count property of your DataTable's DataRowCollection, after Clear executes.

http://msdn2.microsoft.com/en-us/library/system.data.datarowcollection_members.aspx



Re: How do you clear a datatable? by Tony

Tony
Sat Mar 17 10:42:53 CDT 2007

Hello pvd.

Thanks for your reply. I understand now where the data is at different
points in my program. I was confused about DataTables in the dataset as
opposed to tables in the database.

I need to use a DELETE query to initialize the table in the database. Right?

Thanks,
Tony

"pvdg42" <pvdg42@newsgroups.nospam> wrote in message
news:OWrJ6EKaHHA.3584@TK2MSFTNGP02.phx.gbl...
>
> "Tony Girgenti" <tony(nospam)@lakesideos.com> wrote in message
> news:%23eEEQaDaHHA.4872@TK2MSFTNGP03.phx.gbl...
>> Hello Bill.
>>
>> I am absolutely perplexed and frustated by this whole dataset/database
>> concept. I thought i understood it, but now i'm totally confused.
>>
>> I thought a dataset was supposed to be disconnected from the physical
>> database.
>>
>> When i look at a datatable properties in the dataset designer, it defines
>> it as the Items DataTable. If i right click on the Items DataTable in
>> the Dataset designer and select Preview Data..., and click on the Preview
>> button, it shows all of the rows. So if i did a itemsDataBase.Clear, why
>> is the data still there?
>>
>> When i look at the database in Server Explorer, right click on the Items
>> table there and click Show Table Data, it shows the same data.
>>
>> I'm sure that you know way more than i do about this stuff, but i just
>> don't get it.
>>
>> Thanks,
>> Tony
>>
> Everything you say about DataTable objects is correct, except for what
> happens when you look at DataTable contents in the Dataset Designer. When
> you preview data in the designer, the fill() method associated with the
> DataTable object executes to show you what the DataTable *will* hold when
> filled in your application when it runs. If you execute the Clear() method
> in your application, after filling the DataTable, all rows in the
> DataTable will be deleted.
>
> Bill has already pointed out that none of the above has any effect on the
> actual database table, so when you access the preview from Data Designer
> after executing your program, the DataTable is *refilled* with the same
> data (from the database) as before.
>
> To test the effects of Clear(), add some code to your app to access the
> Count property of your DataTable's DataRowCollection, after Clear
> executes.
>
> http://msdn2.microsoft.com/en-us/library/system.data.datarowcollection_members.aspx
>



Re: How do you clear a datatable? by RobinS

RobinS
Sat Mar 17 17:55:01 CDT 2007

If you want to remove all of the data in the table in the database, you
need to use a DELETE query. ("DELETE FROM myTable" will do it.)

Good luck.
Robin S.
------------------------
"Tony Girgenti" <tony(nospam)@lakesideos.com> wrote in message
news:uuW1srKaHHA.3272@TK2MSFTNGP05.phx.gbl...
> Hello pvd.
>
> Thanks for your reply. I understand now where the data is at different
> points in my program. I was confused about DataTables in the dataset as
> opposed to tables in the database.
>
> I need to use a DELETE query to initialize the table in the database.
> Right?
>
> Thanks,
> Tony
>
> "pvdg42" <pvdg42@newsgroups.nospam> wrote in message
> news:OWrJ6EKaHHA.3584@TK2MSFTNGP02.phx.gbl...
>>
>> "Tony Girgenti" <tony(nospam)@lakesideos.com> wrote in message
>> news:%23eEEQaDaHHA.4872@TK2MSFTNGP03.phx.gbl...
>>> Hello Bill.
>>>
>>> I am absolutely perplexed and frustated by this whole dataset/database
>>> concept. I thought i understood it, but now i'm totally confused.
>>>
>>> I thought a dataset was supposed to be disconnected from the physical
>>> database.
>>>
>>> When i look at a datatable properties in the dataset designer, it
>>> defines it as the Items DataTable. If i right click on the Items
>>> DataTable in the Dataset designer and select Preview Data..., and click
>>> on the Preview button, it shows all of the rows. So if i did a
>>> itemsDataBase.Clear, why is the data still there?
>>>
>>> When i look at the database in Server Explorer, right click on the
>>> Items table there and click Show Table Data, it shows the same data.
>>>
>>> I'm sure that you know way more than i do about this stuff, but i just
>>> don't get it.
>>>
>>> Thanks,
>>> Tony
>>>
>> Everything you say about DataTable objects is correct, except for what
>> happens when you look at DataTable contents in the Dataset Designer.
>> When you preview data in the designer, the fill() method associated with
>> the DataTable object executes to show you what the DataTable *will* hold
>> when filled in your application when it runs. If you execute the Clear()
>> method in your application, after filling the DataTable, all rows in the
>> DataTable will be deleted.
>>
>> Bill has already pointed out that none of the above has any effect on
>> the actual database table, so when you access the preview from Data
>> Designer after executing your program, the DataTable is *refilled* with
>> the same data (from the database) as before.
>>
>> To test the effects of Clear(), add some code to your app to access the
>> Count property of your DataTable's DataRowCollection, after Clear
>> executes.
>>
>> http://msdn2.microsoft.com/en-us/library/system.data.datarowcollection_members.aspx
>>
>
>



Re: How do you clear a datatable? by Tony

Tony
Sun Mar 18 05:30:07 CDT 2007

That's what i did Robin. Works Great.

Thanks,
Tony

"RobinS" <RobinS@NoSpam.yah.none> wrote in message
news:guKdna52rNtY7GHYnZ2dnUVZ_ualnZ2d@comcast.com...
> If you want to remove all of the data in the table in the database, you
> need to use a DELETE query. ("DELETE FROM myTable" will do it.)
>
> Good luck.
> Robin S.
> ------------------------
> "Tony Girgenti" <tony(nospam)@lakesideos.com> wrote in message
> news:uuW1srKaHHA.3272@TK2MSFTNGP05.phx.gbl...
>> Hello pvd.
>>
>> Thanks for your reply. I understand now where the data is at different
>> points in my program. I was confused about DataTables in the dataset as
>> opposed to tables in the database.
>>
>> I need to use a DELETE query to initialize the table in the database.
>> Right?
>>
>> Thanks,
>> Tony
>>
>> "pvdg42" <pvdg42@newsgroups.nospam> wrote in message
>> news:OWrJ6EKaHHA.3584@TK2MSFTNGP02.phx.gbl...
>>>
>>> "Tony Girgenti" <tony(nospam)@lakesideos.com> wrote in message
>>> news:%23eEEQaDaHHA.4872@TK2MSFTNGP03.phx.gbl...
>>>> Hello Bill.
>>>>
>>>> I am absolutely perplexed and frustated by this whole dataset/database
>>>> concept. I thought i understood it, but now i'm totally confused.
>>>>
>>>> I thought a dataset was supposed to be disconnected from the physical
>>>> database.
>>>>
>>>> When i look at a datatable properties in the dataset designer, it
>>>> defines it as the Items DataTable. If i right click on the Items
>>>> DataTable in the Dataset designer and select Preview Data..., and click
>>>> on the Preview button, it shows all of the rows. So if i did a
>>>> itemsDataBase.Clear, why is the data still there?
>>>>
>>>> When i look at the database in Server Explorer, right click on the
>>>> Items table there and click Show Table Data, it shows the same data.
>>>>
>>>> I'm sure that you know way more than i do about this stuff, but i just
>>>> don't get it.
>>>>
>>>> Thanks,
>>>> Tony
>>>>
>>> Everything you say about DataTable objects is correct, except for what
>>> happens when you look at DataTable contents in the Dataset Designer.
>>> When you preview data in the designer, the fill() method associated with
>>> the DataTable object executes to show you what the DataTable *will* hold
>>> when filled in your application when it runs. If you execute the Clear()
>>> method in your application, after filling the DataTable, all rows in the
>>> DataTable will be deleted.
>>>
>>> Bill has already pointed out that none of the above has any effect on
>>> the actual database table, so when you access the preview from Data
>>> Designer after executing your program, the DataTable is *refilled* with
>>> the same data (from the database) as before.
>>>
>>> To test the effects of Clear(), add some code to your app to access the
>>> Count property of your DataTable's DataRowCollection, after Clear
>>> executes.
>>>
>>> http://msdn2.microsoft.com/en-us/library/system.data.datarowcollection_members.aspx
>>>
>>
>>
>
>



Re: How do you clear a datatable? by William

William
Sun Mar 18 13:48:19 CDT 2007

Yes, FWIW TRUNCATE is faster than delete. It's not logged and let's the QO
know that it need not deal with other issues.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------

"RobinS" <RobinS@NoSpam.yah.none> wrote in message
news:guKdna52rNtY7GHYnZ2dnUVZ_ualnZ2d@comcast.com...
> If you want to remove all of the data in the table in the database, you
> need to use a DELETE query. ("DELETE FROM myTable" will do it.)
>
> Good luck.
> Robin S.
> ------------------------
> "Tony Girgenti" <tony(nospam)@lakesideos.com> wrote in message
> news:uuW1srKaHHA.3272@TK2MSFTNGP05.phx.gbl...
>> Hello pvd.
>>
>> Thanks for your reply. I understand now where the data is at different
>> points in my program. I was confused about DataTables in the dataset as
>> opposed to tables in the database.
>>
>> I need to use a DELETE query to initialize the table in the database.
>> Right?
>>
>> Thanks,
>> Tony
>>
>> "pvdg42" <pvdg42@newsgroups.nospam> wrote in message
>> news:OWrJ6EKaHHA.3584@TK2MSFTNGP02.phx.gbl...
>>>
>>> "Tony Girgenti" <tony(nospam)@lakesideos.com> wrote in message
>>> news:%23eEEQaDaHHA.4872@TK2MSFTNGP03.phx.gbl...
>>>> Hello Bill.
>>>>
>>>> I am absolutely perplexed and frustated by this whole dataset/database
>>>> concept. I thought i understood it, but now i'm totally confused.
>>>>
>>>> I thought a dataset was supposed to be disconnected from the physical
>>>> database.
>>>>
>>>> When i look at a datatable properties in the dataset designer, it
>>>> defines it as the Items DataTable. If i right click on the Items
>>>> DataTable in the Dataset designer and select Preview Data..., and click
>>>> on the Preview button, it shows all of the rows. So if i did a
>>>> itemsDataBase.Clear, why is the data still there?
>>>>
>>>> When i look at the database in Server Explorer, right click on the
>>>> Items table there and click Show Table Data, it shows the same data.
>>>>
>>>> I'm sure that you know way more than i do about this stuff, but i just
>>>> don't get it.
>>>>
>>>> Thanks,
>>>> Tony
>>>>
>>> Everything you say about DataTable objects is correct, except for what
>>> happens when you look at DataTable contents in the Dataset Designer.
>>> When you preview data in the designer, the fill() method associated with
>>> the DataTable object executes to show you what the DataTable *will* hold
>>> when filled in your application when it runs. If you execute the Clear()
>>> method in your application, after filling the DataTable, all rows in the
>>> DataTable will be deleted.
>>>
>>> Bill has already pointed out that none of the above has any effect on
>>> the actual database table, so when you access the preview from Data
>>> Designer after executing your program, the DataTable is *refilled* with
>>> the same data (from the database) as before.
>>>
>>> To test the effects of Clear(), add some code to your app to access the
>>> Count property of your DataTable's DataRowCollection, after Clear
>>> executes.
>>>
>>> http://msdn2.microsoft.com/en-us/library/system.data.datarowcollection_members.aspx
>>>
>>
>>
>
>



Re: How do you clear a datatable? by Rad

Rad
Sun Mar 18 14:37:54 CDT 2007

On Sun, 18 Mar 2007 11:48:19 -0700, William (Bill) Vaughn wrote:

> Yes, FWIW TRUNCATE is faster than delete. It's not logged and let's the QO
> know that it need not deal with other issues.

Though truncating is not always possible -- foreign key tables and
replicating tables for instance...

--
Bits.Bytes
http://bytes.thinkersroom.com

Re: How do you clear a datatable? by RobinS

RobinS
Sun Mar 18 18:43:25 CDT 2007

That's true, I forget about Truncate because I so rarely clear out my data
tables. Thanks for the catch!

I bet that's covered fully in your book. ;-)

Robin S.
------------------------------------------------
"William (Bill) Vaughn" <billvaRemoveThis@nwlink.com> wrote in message
news:up1fA4YaHHA.5032@TK2MSFTNGP02.phx.gbl...
> Yes, FWIW TRUNCATE is faster than delete. It's not logged and let's the
> QO know that it need not deal with other issues.
>
> --
> ____________________________________
> William (Bill) Vaughn
> Author, Mentor, Consultant
> Microsoft MVP
> INETA Speaker
> www.betav.com/blog/billva
> www.betav.com
> Please reply only to the newsgroup so that others can benefit.
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
> __________________________________
> Visit www.hitchhikerguides.net to get more information on my latest book:
> Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
> and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
> -----------------------------------------------------------------------------------------------------------------------
>
> "RobinS" <RobinS@NoSpam.yah.none> wrote in message
> news:guKdna52rNtY7GHYnZ2dnUVZ_ualnZ2d@comcast.com...
>> If you want to remove all of the data in the table in the database, you
>> need to use a DELETE query. ("DELETE FROM myTable" will do it.)
>>
>> Good luck.
>> Robin S.
>> ------------------------
>> "Tony Girgenti" <tony(nospam)@lakesideos.com> wrote in message
>> news:uuW1srKaHHA.3272@TK2MSFTNGP05.phx.gbl...
>>> Hello pvd.
>>>
>>> Thanks for your reply. I understand now where the data is at different
>>> points in my program. I was confused about DataTables in the dataset
>>> as opposed to tables in the database.
>>>
>>> I need to use a DELETE query to initialize the table in the database.
>>> Right?
>>>
>>> Thanks,
>>> Tony
>>>
>>> "pvdg42" <pvdg42@newsgroups.nospam> wrote in message
>>> news:OWrJ6EKaHHA.3584@TK2MSFTNGP02.phx.gbl...
>>>>
>>>> "Tony Girgenti" <tony(nospam)@lakesideos.com> wrote in message
>>>> news:%23eEEQaDaHHA.4872@TK2MSFTNGP03.phx.gbl...
>>>>> Hello Bill.
>>>>>
>>>>> I am absolutely perplexed and frustated by this whole
>>>>> dataset/database concept. I thought i understood it, but now i'm
>>>>> totally confused.
>>>>>
>>>>> I thought a dataset was supposed to be disconnected from the physical
>>>>> database.
>>>>>
>>>>> When i look at a datatable properties in the dataset designer, it
>>>>> defines it as the Items DataTable. If i right click on the Items
>>>>> DataTable in the Dataset designer and select Preview Data..., and
>>>>> click on the Preview button, it shows all of the rows. So if i did a
>>>>> itemsDataBase.Clear, why is the data still there?
>>>>>
>>>>> When i look at the database in Server Explorer, right click on the
>>>>> Items table there and click Show Table Data, it shows the same data.
>>>>>
>>>>> I'm sure that you know way more than i do about this stuff, but i
>>>>> just don't get it.
>>>>>
>>>>> Thanks,
>>>>> Tony
>>>>>
>>>> Everything you say about DataTable objects is correct, except for what
>>>> happens when you look at DataTable contents in the Dataset Designer.
>>>> When you preview data in the designer, the fill() method associated
>>>> with the DataTable object executes to show you what the DataTable
>>>> *will* hold when filled in your application when it runs. If you
>>>> execute the Clear() method in your application, after filling the
>>>> DataTable, all rows in the DataTable will be deleted.
>>>>
>>>> Bill has already pointed out that none of the above has any effect on
>>>> the actual database table, so when you access the preview from Data
>>>> Designer after executing your program, the DataTable is *refilled*
>>>> with the same data (from the database) as before.
>>>>
>>>> To test the effects of Clear(), add some code to your app to access
>>>> the Count property of your DataTable's DataRowCollection, after Clear
>>>> executes.
>>>>
>>>> http://msdn2.microsoft.com/en-us/library/system.data.datarowcollection_members.aspx
>>>>
>>>
>>>
>>
>>
>
>