473,326 Members | 2,111 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

C# Windows Form ListView concept

Hi,

In my C# Windows Form application, I have a ListView control Lvw1 in MyForm.
For most cases, the Lvw1 has no more than 5 rows of data. But now comes the
situation that one user has to input approximately 100 rows into the Lvw1.

Case1, 5 rows.
Case2, 3 rows.
....
CaseX, 100 rows.

We used to process the Update/Delete as:
DELETE all rows in the Database Table which has the item value CaseX, then
INSERT into the database from the existing rows in Lvw1.
But this seems kind of too risky, I'm thinking is there a better solution
for doing the Update/Delete?

Thanks for help.
Jason
Apr 14 '07 #1
2 2118
Jason,

Why is it risky? I mean, that is the logic. Now, if the 100 rows are
going to be constant for case X, then you can get away with an update, but
something tells me that the 100 rows of data will sometimes be 101 rows or
99 rows, or some other variable number. In this case, it makes sense to
just issue the one delete, and then to perform the inserts.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Jason Huang" <Ja************@hotmail.comwrote in message
news:uf**************@TK2MSFTNGP04.phx.gbl...
Hi,

In my C# Windows Form application, I have a ListView control Lvw1 in
MyForm. For most cases, the Lvw1 has no more than 5 rows of data. But now
comes the situation that one user has to input approximately 100 rows into
the Lvw1.

Case1, 5 rows.
Case2, 3 rows.
...
CaseX, 100 rows.

We used to process the Update/Delete as:
DELETE all rows in the Database Table which has the item value CaseX, then
INSERT into the database from the existing rows in Lvw1.
But this seems kind of too risky, I'm thinking is there a better solution
for doing the Update/Delete?

Thanks for help.
Jason

Apr 14 '07 #2
On Apr 13, 10:17 pm, "Jason Huang" <JasonHuang8...@hotmail.comwrote:
Hi,

In my C# Windows Form application, I have a ListView control Lvw1 in MyForm.
For most cases, the Lvw1 has no more than 5 rows of data. But now comes the
situation that one user has to input approximately 100 rows into the Lvw1.

Case1, 5 rows.
Case2, 3 rows.
...
CaseX, 100 rows.

We used to process the Update/Delete as:
DELETE all rows in the Database Table which has the item value CaseX, then
INSERT into the database from the existing rows in Lvw1.
But this seems kind of too risky, I'm thinking is there a better solution
for doing the Update/Delete?
It's only risky if you're not using a transaction. Carry out the
deletes and inserts within a single transaction. That way they will
either all occur, or none will occur.

Apr 15 '07 #3

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

Similar topics

15
by: Wiktor Zychla | last post by:
today we've found a critical issue regarding the ListView from Windows.Forms. it was confirmed on several machines with Win2K and XP. here's the problem: create a ListView with about 50000 rows....
2
by: Aaron Queenan | last post by:
Is there any way to know whether the OnItemCheck is being called in response to a user action (mouse or keyboard) as opposed to the form loading? I have a class which derives from...
2
by: Raed Sawalha | last post by:
i have a windows form(Main) with listview, when click an item in listview i open other window form (Sub) which generate the selected item from parent window in as treeview items when click any item...
3
by: Bill Kinnersley | last post by:
I have a Windows Form with a very large ListView, about 10,000 items. There is a very significant delay each time the form is opened (ShowDialog) or closed (Hide). The ListView has not been...
2
by: Ryan Liu | last post by:
Hi, Can someone give me a hlep on inherited user control? I try to inherite windows forms user control, like ListView. From Visual studio 2003, I right click a folder and selct "Add...
0
by: Terry Brown | last post by:
I have a form which contains a listview item. The form is created to view data that is generated by interaction with a separate form. There are buttons on the form that change the data source...
1
by: Rune Jacobsen | last post by:
Hi all, I have an application with one particular form that lists a number of items in a listview. In addition to the listview, there is a panel on top with some simple controls to go back and...
1
by: Pumpkin Carver | last post by:
I have a form that has a listview on it and a serious of strings in the listiew. When i doubel click on the listview item it opens a new form and displays the text that i pass to the constructor....
4
by: =?Utf-8?B?RXRoYW4gU3RyYXVzcw==?= | last post by:
Hi, I have just started building an application which is windows form based, rather than web based, and I am having troubles with layout. I can't find any control which gives me just a simple text...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.