Duplicate record from Datagrid.
-
Hi, I have a Datagrid.now i generate a store procedure(suppose "select * from employee").now using the SP i generate a DataSet and bind a Datagrid.The Datagrid have 1000 records.Now can i find the duplicates records only from the front end.without using any store procedure. (like dataview or etc)
-
Hi, I have a Datagrid.now i generate a store procedure(suppose "select * from employee").now using the SP i generate a DataSet and bind a Datagrid.The Datagrid have 1000 records.Now can i find the duplicates records only from the front end.without using any store procedure. (like dataview or etc)
Hi, To find duplicated records use the above code sample : DataView v = myDataSet.Tables["YourTable"].DefaultView; v.Sort = "YourPrimaryKey ASC"; Dictionary> duplicatedRecords = new Dictionary>(); for (int i = 0; i< v.Count -1; i++) { int j = i +1; object iValue = v[i]["YourPrimaryKey "]; while (v[j]["YourPrimaryKey "] == iValue) { if (! duplicatedRecords.ContainsKey(i)) { duplicatedRecords.Add(i, new List()); } duplicatedRecords[i].Add(j); j++; } i = j; } HTH. Hayder Marzouk