I have a datatable storing info about a student classroom. My table looks like this:
Student ID Grade Absence Count
00001 85 0
00002 95 7
00002 70 5
00003 35 1
Dont ask me why there are two id's that are the same... its just the way it is. Now i want to update the absence count for the 00002 id that has absence count of 7. At the same time, i want to delete the 00002 entry that doesnt have the absence count of 7 (in this case the one with count 5). Now i know how to query the table with a select statement and update the 00002 id student with count 7. How can i, at the same time, delete the other entry for the 00002 student? This is my code:
foreach(oldCount in absenceCount)
{
DataRow[] dr = dt.Select("Student ID='" + ID + "' AND Absence Count='" + oldCount);
dr[0]["Absence Count"] = newCount;
}
So here how can i tell the program that if there is another student id whose absence count isnt in the absenceCount list, delete it from the table?
Thanks