Dataset (checking duplicate record)

  • Thread starter Thread starter Arvi
  • Start date Start date
A

Arvi

Hi,

Is there any way to check for the duplicated (fluteid) records in the
dataset other than the following method?

i need to avoid goin thru all the records everytime (squaremethod) instead
i want to check with the triangle method. can someone help me here?



foreach (Dataset.FluteRow row in dataSet.Flute.Rows)

{

idToCheck = row.FluteID;

linkToCheck = row.FluteLink;



foreach (Dataset.FluteRow row1 in dataSet.Flute.Rows)

{

if(row1.FluteID == idToCheck && row1.FluteLink != linkToCheck)

{

duplicateID.Add(row1.FluteID);

}

}


}
 
ok thanks..

i figured out a solution

for(int i = 0; i < dataSet.table.Rows.Count ; i++)

{

Dataset.Row row = dataSet.table.Rows as Dataset.Row;

if(row.RowState.ToString() != "Deleted")

{

idToCheck = row.ID;

linkToCheck = row.Link;

}

for(int j=i+1; j < dataSet.table.Rows.Count; j++)

{

Dataset.Row row1 = dataSet.table.Rows[j] as Dataset.Row;

if(row1.RowState.ToString() != "Deleted")

{

if(row1.ID == idToCheck)

{

duplicateID.Add(row1);

}

}

}


}
 
Back
Top