If you are walking through a dataset or datarow printing things out, you can skip duplicates by using a list to keep track of what you have done so far.
var dupcheck = new List<string>();
foreach (DataRow dr in dt.Rows)
{
//rowIndex++;
string partNumber = dr[1]+"";
if(dupcheck.Contains(partNumber)) continue; //skip duplicate
dupcheck.Add(partNumber); //print out the partnumber }
Leave a Comment
Comments