22-06-22 08:02 AM
ID Name Email Mobile
1 A A@GMAIL.COM 91****
2 B B@GMAIL.COM 91****
3 C C@GMAIL.COM 91****
4 A A@GMAIL.COM 91****
5 B B@GMAIL.COM 91****
6 D D@GMAIL.COM 91****
Expected Output Collection:
Name Email
A A@GMAIL.COM
B B@GMAIL.COM
C C@GMAIL.COM
D D@GMAIL.COM
Edit:
22-06-22 09:30 AM
public DataTable RemoveDuplicateRows(DataTable dTable, string colName)
{
Hashtable hTable = new Hashtable();
ArrayList duplicateList = new ArrayList();
//Add list of all the unique item value to hashtable, which stores combination of key, value pair.
//And add duplicate item value in arraylist.
foreach (DataRow drow in dTable.Rows)
{
if (hTable.Contains(drow[colName]))
duplicateList.Add(drow);
else
hTable.Add(drow[colName], string.Empty);
}
//Removing a list of duplicate items from datatable.
foreach (DataRow dRow in duplicateList)
dTable.Rows.Remove(dRow);
//Datatable which contains unique records will be return as output.
return dTable;
}
22-06-22 09:42 AM
Dim listOfFields = New List(Of String)()
For Each row In Field_Names.Rows
listOfFields.Add(row("Fields").ToString())
Next
Output_Collection = Input_Collection.DefaultView.ToTable(True,listOfFields.ToArray())
23-06-22 11:01 AM
23-06-22 11:22 AM
Dim listOfFields = New List(Of String)()
For Each row As System.Data.DataRow In Field_Names.Rows
listOfFields.Add(row("Fields").ToString())
Next
Output_Collection = Input_Collection.DefaultView.ToTable(True,listOfFields.ToArray())
23-06-22 11:54 AM
06-07-22 02:03 PM
07-07-22 07:30 AM
17-10-22 04:44 PM