473,513 Members | 3,208 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Deleting multiuple rows from a database...

I am working on a new vb.net 2005 project using SQL server 2000 as the
backend db.

I have a listview where control I want a user to be able to select either
just one or multiple rows in the listview and perform an action on them. If
the user chooses to delete these rows I wonder what the best way to handle
the deletion of multiple rows is...

Right now I have a stored procedure for deleteing jsut opne row. i.e delete
from {tablename} where field1 = Parm1". However, if the user selects say 10
rows, should I loop through the lsitview items and call this SP each time,
OR can I somehow batch them so that I can run the stored procedure just
once - which would then delete all selected rows using a clause similiar to
the following.... "delete from {tablename} where field1 in (select field1
from{tempdeleteditemstable})"

Any ideas if this is the best way to do it - or is simply looping through
the listview and calling the stored proc to do a single row delete each time
ok? They would never be deleting that many items at once - but definately
there may be times when multiple deletes will be required...

Thanks, Brad
Mar 11 '08 #1
2 1641
Brad,

The best way is to use a Data related control like the DataGridView or the
DataGrid (eventualy with no row and column headers) and for sure not the
listview which is more intended for things as showing things like files.

Cor

Mar 12 '08 #2
Never been a fan of the datagrid at all- just doesn't give you the proper
control I have found. It's always seemed clumsy to me and hard to really do
what you want with it...

I have not tried the datagridview. Maybe I should take a look at it...

Thanks, Brad

"Cor Ligthert[MVP]" <no************@planet.nlwrote in message
news:E8**********************************@microsof t.com...
Brad,

The best way is to use a Data related control like the DataGridView or the
DataGrid (eventualy with no row and column headers) and for sure not the
listview which is more intended for things as showing things like files.

Cor

Mar 12 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
7840
by: rishi | last post by:
Looking for tips on how to improve performance on deleting records. In our database we do dataloads daily that require us to purge millions of records a day so any improvement in speed would be...
2
2176
by: Zak McGregor | last post by:
Hi all I have a table, for simplicity's sake containing one field, called unid. for example, select unid, oid from table gives me something like this: unid | oid ---------+---------
4
1638
by: Jim Michaels | last post by:
Is it safe to do what is below? deleting from a resultset while you are processing it? I don't know how dynamic the SQL database is. I assume you get a cursor to live dataset. Even if it is a...
9
1704
by: Hamed | last post by:
Hello I have a DataGrid that a is bound to a DataTable. Some of the rows in the DataTable should not be deleted. How can I prohibit deleting of some identified rows? The problem could be...
7
6587
by: Susan Mackay | last post by:
I have a data table that is connected to a database table with a data adapter in the 'standard' manner. However I want to be able to remove selected rows from the data table (i.e. no longer...
24
21522
by: Frank Swarbrick | last post by:
We have a batch process that inserts large numbers (100,000 - 1,000,000) of records into a database each day. (DL/I database.) We're considering converting it to a DB2 table. Currently we have...
1
2832
by: dmcadams | last post by:
I need help deleting 300 Millions of rows from a table and then reclaim the space in the table after completing the delete process. The database needs to be online and available to the users. There...
5
2034
flexsingh
by: flexsingh | last post by:
Hello there, I have been trying to delete a row in php for a long time now and its getting frustrating, can any see if they could possible help me please. My first page is <?php // this...
1
1697
by: Kyosuke18 | last post by:
Hi everyone, I have a problem in deleting a data that is connected on the database.. I tried this code but it shows me an error: Run-time error '-2147217900(80040e14)': Syntax error in string in...
0
7254
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7153
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7373
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7432
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7519
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5079
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4743
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1585
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
796
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.