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
>>>>
>>>
>>>
>>
>>
>
>