Reputation: 13614
I have table(Color
) in DataSet(dsObjets
).
I want to remove specific row(specific ColorID
) from this table.
Any idea how can I implement this with help of LINQ?
Upvotes: 0
Views: 6180
Reputation: 30698
Try this
var results = from row in dsObjects.Tables["Color"].AsEnumerable()
where row.Field<int>("ColorID") == <color ID to be removed>
select row;
foreach (DataRow row in results)
{
dsObjects.Tables["Color"].Remove(row);
}
Upvotes: 1
Reputation: 6336
Here is more information on deleting records: http://msdn.microsoft.com/en-us/library/bb386925.aspx
To delete a row in the database:
Upvotes: 1