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("one@mail.com");
al.Add("two@mail.com");
al.Add("nine@mail.com");
al.Add("ten@mail.com");
DataRow r1 = dt.NewRow(); r1["email"] = "one@mail.com"; //addtype+card// dt.Rows.Add(r1);
DataRow r2 = dt.NewRow(); r2["email"] = "one@mail.com"; //addtype+card// dt.Rows.Add(r2);
DataRow r3 = dt.NewRow(); r3["email"] = "two@mail.com"; //addtype+card// dt.Rows.Add(r3);
DataRow r4 = dt.NewRow(); r4["email"] = "four@mail.com"; //addtype+card// dt.Rows.Add(r4);
DataRow r5 = dt.NewRow(); r5["email"] = "five@mail.com"; //addtype+card// dt.Rows.Add(r5);
So from the above row r4 and r5 will be deleted from the datatable.