Hi I have a datatable that is fed by a textfile with filenames I already have. (DatatableFile)
I also have a datatable with all the filenames in. (DatatableValue)
I want to remove the filenames that exist in DatatableFile from the DatatableValue so I can do the next step.
I have done this but its sooooo slow.
And al the example i have found is so big and complicate. I think that there is a way easyer solution then them i found and a mutch faster then my.
My solution iterate all the results thats in the datatableFile every row thats in the datatableValue and this just become bigger and bigger. And when there is a match it takes that rownumber and saves it in a array for later process.
And after it have checked the two tables then it starts to clear the files it have alredy have.
This can be achieved using LINQ statements and manipulating the datatables.
First lets get a list of the files you already have, this can be done with an assign.
lstStrCurrentFiles
= DatatableFile.AsEnumerable().Select(Function (r) r(0).ToString).ToList()
Now lets exclude those from the datatable of all files you have, again this can be done using an assign.
DatatableValue
= DatatableValue.AsEnumerable.Where(Function (dr) not lstStrCurrentFiles.Contains(dr(1).ToString)).CopyToDataTable
This gives you the below sequence