Try this :
Datatable dtCopy = new DataTable() ;
dtCopy.Columns.Add("IP");
dtCopy.Columns.Add("Status");
dtCopy.Columns.Add("Count");
foreach (DataRow r in dtOriginal.Rows)
{
bool matchFound = false;
foreach (DataRow r1 in dtCopy.Rows)
{
if(r("IP").ToString() = r1("IP").ToString() && r("Status").ToString() = r1("Status").ToString())
{
int currentCount = 0 ;
int.TryParse(r1("Count").ToString() , currentCount);
currentCount+=1;
r1("Count") =currentCount.ToString();
matchFound= true;
break;
}
}
if (matchFound==false)
{
DataRow newRow = dtCopy.NewRow();
newRow("IP") = r("IP").ToString();
newRow("Count") = r("Count").ToString();
newRow("Status") = r("Status").ToString();
dtCopy.Rows.Add(newRow);
}
}
Did not test the code but hope it helps.