c# - Checking value in column foreach row -
the datatable (dt) stores retrieved values of carid's , makes stores 3 rows within datatable, have datatable called dt2 stores carid's , makes, trying loop through each row in dt see if carid stored in dt exists in of rows in dt2, here have far: datatable dt = w.getusercars(userid); foreach (datarow dr in dt.rows) { string carid = dr["carid"].tostring(); } how do this? you should able achieve using datatable.select() method. on right track. need add method find row (s) in dt2 . datatable dt = w.getusercars(userid); datarow[] foundrows; foreach (datarow dr in dt.rows) { string carid = dr["carid"].tostring(); foundrows = dt2.select("carid = " + carid); // stuff here foundrows foreach (datarow r in foundrows) { r.delete(); } }