I simply want to compare the first col of the datatable called "name" to items in the array. They can be multiple rows in the datatable with the same name. After it has compared all items in the array it should delete the rows that were NOT from the datatable. The output result can be the datatable itself or list array (prefer this) however this should retain all the columns from datatable. Possibly want to use linq query.
code:
DataTable dt = new DataTable("TestTable");
dt.Columns.Add(new DataColumn("email",System.Type.GetType("System.String")));
dt.Columns.Add(new DataColumn("type",System.Type.GetType("System.String")));
dt.Columns.Add(new DataColumn("card",System.Type.GetType("System.String")));
ArrayList al = new ArrayList();
al.Add("[email protected]");
al.Add("[email protected]");
al.Add("[email protected]");
al.Add("[email protected]");
DataRow r1 = dt.NewRow(); r1["email"] = "[email protected]"; //addtype+card// dt.Rows.Add(r1);
DataRow r2 = dt.NewRow(); r2["email"] = "[email protected]"; //addtype+card// dt.Rows.Add(r2);
DataRow r3 = dt.NewRow(); r3["email"] = "[email protected]"; //addtype+card// dt.Rows.Add(r3);
DataRow r4 = dt.NewRow(); r4["email"] = "[email protected]"; //addtype+card// dt.Rows.Add(r4);
DataRow r5 = dt.NewRow(); r5["email"] = "[email protected]"; //addtype+card// dt.Rows.Add(r5);
So from the above row r4 and r5 will be deleted from the datatable.