views:

46

answers:

3

How do i achieve simple sql query like

delete from Users where userCity='Munich'

with DataTables ?

p.s. without using Linq or something like that simply because i do not use it though project.

+3  A: 
DataRow[] rows;
rows=dataTable.Select("userCity = 'Munich'");
foreach(DataRow r in rows)
r.Delete();
m0s
A: 

DataTable dt =ds.tables[0]; DataRow row =dt.Select("the condition") dt.Rows.Remove(row);

+1  A: 
DataRow[] rows = YourDataTable.Select("Your Condition");
foreach(DataRow r in rows)
r.Delete();
Johnny