PC Review


Reply
Thread Tools Rate Thread

Deleting ALL rows

 
 
Brad Allison
Guest
Posts: n/a
 
      21st May 2004
I have a table where the user stores recent search words used. There is
occassion where this table needs to be cleared and deleted of all data. Is
there an easy way to just take the dataset, mark all rows as deleted and
then use the data adapters Update?

Thanks for the information.

Brad


 
Reply With Quote
 
 
 
 
Val Mazur
Guest
Posts: n/a
 
      21st May 2004
Hi Brad,

DataRow collection, which keeps all the rows in a datatable does not have
any method, which would allow to mark all the rows as a deleted without
looping. I think best way in your case is to execute DELETE SQL statement
against database and just dispose DataSet locally or call Clear method to
delete all the rows

--
Val Mazur
Microsoft MVP


"Brad Allison" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I have a table where the user stores recent search words used. There is
> occassion where this table needs to be cleared and deleted of all data.
> Is
> there an easy way to just take the dataset, mark all rows as deleted and
> then use the data adapters Update?
>
> Thanks for the information.
>
> Brad
>
>



 
Reply With Quote
 
Mirko Geffken
Guest
Posts: n/a
 
      21st May 2004
Hi Brad,

this is possible, but highly inefficient if I understand correctly what you
intend to do. If you just want to delete all keywords in the table (or just
the ones of a particular user) it would be much faster to just issue a
single delete statement against the DB (such as DELETE FROM keywords or
DELETE FROM keywords WHERE user='xxx').

If you use the dataadapter then this will translate to several (however many
rows you are deleting) delete statements to be executed against the RDBMS.

Hope this helped
Mirko
"Brad Allison" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I have a table where the user stores recent search words used. There is
> occassion where this table needs to be cleared and deleted of all data.

Is
> there an easy way to just take the dataset, mark all rows as deleted and
> then use the data adapters Update?
>
> Thanks for the information.
>
> Brad
>
>



 
Reply With Quote
 
Bernie Yaeger
Guest
Posts: n/a
 
      21st May 2004
Hi Brad,

I assume this is an sql server table. Why not just run a stored proc that
calls 'truncate swordtable'.

HTH,

Bernie Yaeger

"Brad Allison" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I have a table where the user stores recent search words used. There is
> occassion where this table needs to be cleared and deleted of all data.

Is
> there an easy way to just take the dataset, mark all rows as deleted and
> then use the data adapters Update?
>
> Thanks for the information.
>
> Brad
>
>



 
Reply With Quote
 
DNE
Guest
Posts: n/a
 
      21st May 2004
The framework extensions libraries I have developed have an extended dataset
which supports deletion of multiple rows by criteria (which may be blank)
with a single command.

Fully documented. Requires .NET framework 1.1 or later.

You will be allowed to use the libraries in any application - private or
commercial, and distribute them as part of your application, royalty-free.

E-mail me for your free copy: (E-Mail Removed)
Your acceptance of the license agreement will be required.

Ori


"Brad Allison" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I have a table where the user stores recent search words used. There is
> occassion where this table needs to be cleared and deleted of all data.

Is
> there an easy way to just take the dataset, mark all rows as deleted and
> then use the data adapters Update?
>
> Thanks for the information.
>
> Brad
>
>



 
Reply With Quote
 
Brad Allison
Guest
Posts: n/a
 
      21st May 2004
Bernie,

This is actually an Access table. I would be able to run a DELETE * FROM
statement I think. I have not tried it yet, but I will later.

Thanks for the information.

Brad

"Bernie Yaeger" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi Brad,
>
> I assume this is an sql server table. Why not just run a stored proc that
> calls 'truncate swordtable'.
>
> HTH,
>
> Bernie Yaeger
>
> "Brad Allison" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > I have a table where the user stores recent search words used. There is
> > occassion where this table needs to be cleared and deleted of all data.

> Is
> > there an easy way to just take the dataset, mark all rows as deleted and
> > then use the data adapters Update?
> >
> > Thanks for the information.
> >
> > Brad
> >
> >

>
>



 
Reply With Quote
 
Cowboy
Guest
Posts: n/a
 
      21st May 2004
Yes, but it is not very friendly. When you fire Update, you loop through
each record. It is much better to create a destruct stored procedure or fire
"DELETE FROM TableName" at the database than to incur the overhead of the
loop.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

************************************************
Think Outside the Box!
************************************************
"Brad Allison" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I have a table where the user stores recent search words used. There is
> occassion where this table needs to be cleared and deleted of all data.

Is
> there an easy way to just take the dataset, mark all rows as deleted and
> then use the data adapters Update?
>
> Thanks for the information.
>
> Brad
>
>



 
Reply With Quote
 
Cowboy
Guest
Posts: n/a
 
      21st May 2004
You can run a DELETE FROM and kill all of the data quite easily. I believe
Access has a TRUNCATE function (name?) as well.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

************************************************
Think Outside the Box!
************************************************
"Brad Allison" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Bernie,
>
> This is actually an Access table. I would be able to run a DELETE * FROM
> statement I think. I have not tried it yet, but I will later.
>
> Thanks for the information.
>
> Brad
>
> "Bernie Yaeger" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Hi Brad,
> >
> > I assume this is an sql server table. Why not just run a stored proc

that
> > calls 'truncate swordtable'.
> >
> > HTH,
> >
> > Bernie Yaeger
> >
> > "Brad Allison" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > I have a table where the user stores recent search words used. There

is
> > > occassion where this table needs to be cleared and deleted of all

data.
> > Is
> > > there an easy way to just take the dataset, mark all rows as deleted

and
> > > then use the data adapters Update?
> > >
> > > Thanks for the information.
> > >
> > > Brad
> > >
> > >

> >
> >

>
>



 
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
deleting blank rows for up to 60000 rows of data gbpg Microsoft Excel Programming 3 27th Dec 2009 09:37 PM
Macro for deleting rows and serialising the remaing rows Srinivasulu Bhattaram Microsoft Excel Programming 2 13th Nov 2008 02:32 PM
Macro for deleting rows and serialising the remaing rows Srinivasulu Bhattaram Microsoft Excel Worksheet Functions 1 12th Nov 2008 02:39 PM
Macro for deleting rows and serialising the remaing rows Srinivasulu Bhattaram Microsoft Excel Discussion 1 12th Nov 2008 02:32 PM
Excel 2000 VBA Deleting Rows when certain text in rows exists scain2004 Microsoft Excel New Users 1 15th Mar 2004 03:11 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:48 PM.