2
Reply

delete datarows from datatable

abas shahen

abas shahen

Dec 14 2009 2:34 PM
8.3k
hi all, i beleive that i can delete rows from database by using sqldataadapter with deletecommand. in my scenario i want to delete some rows from my datatable without retreiving any rows from database, because no rows added by other users in this scenario. i have stored procedure to retrieve data from database then sqldataadapter filling my datatable without formating the datatable cols and rows because the data retrived from database directly. i want to delete some rows and add some rows to another table from the old table by using traditional command to delete rows from databse and using Datatable methods to delete rows from datatables but when i doing it i get the datatable dont have primary key. i want to know following : 1- when i retrieving rows from database by sqldataadapter directly to datatable , how i can delete rows from datatable ? 2- this approach is good, such as keep rows in datatable and delete required rows from datatable by datatable methods and delete rows from database by using traditional command? or delete by using sqldataadapter and using update method? note: after delete i dont want to retreive any more rows from database. thx alot

Answers (2)