Click here to Skip to main content
15,895,801 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
in my project i've a database and also have a list view, when any values enter to the database it name should be shows in list view. i am using

C#
foreach (ListViewItem eachItem in listView_Overlay.SelectedItems)
            {
                listView_Overlay.Items.Remove(eachItem);
            }

for deleting the selected item from listview,


but i want to delete it from the database also, pls mention a simple method to delete from database simultanuosly.
Posted

1 solution

Hi,

if you are using .NET Framework 3.5 and later versions, you can use Linq for deleting the rows from database table. if you are using previous version of .NET framework, you have to use normal ADO.NET codes for deleting rows from database.

refer

How to: Delete Rows From the Database[^]
LINQ to SQL[^]
LINQ to SQL Samples[^]

hope it helps.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900