Delete datatable row using arraylist

I have userIDs in arraylist. I want to remove same userId rows from datatable.
How can i do that?

Hi @ekaraoglu

You can do something like this

List<string> liststr = new List<string>();
        liststr.Add("one");
        liststr.Add("two");
        liststr.Add("two");
        liststr= liststr.Distinct().ToList(); 

Thanks,
Prankur

1 Like

I want to delete userid list inside datatable. How can i do that using loop? I am using int array.

You cannot delete an item while in loop, you can try these

dtYourDatatable.DefaultView.ToTable(True,"ColumnName")

Thanks,
Prankur

1 Like

@ekaraoglu

Let us take your array list as ListABC and dataTable as dta
dtb as Filtered DataTable.

dtb=(From p In dta.Select
       Where not ListABC.Contains(Convert.ToString(p("UserID"))
      Select p).ToArray.CopyToDataTable

Regards,
Mahesh

1 Like