For Example
in Image if Status Column Contain “FineOLD” then Replace Number in Category Column with “Ready”
I don’t want to use loops here for some reason.
Is there any other ways to replace the values in Datatable without using Loops?
For Example
in Image if Status Column Contain “FineOLD” then Replace Number in Category Column with “Ready”
I don’t want to use loops here for some reason.
Is there any other ways to replace the values in Datatable without using Loops?
Hi @Kathiravan
You can use invoke code for this case
assume you had stored the excel in datatable variable dt1
in invoke code pass the dt1 as argument with direction as in/out
in the code write like this
dt1.AsEnumerable().Where(Function(row) row(“Status”).ToString.Equals(“FineOLD”)).ToList().ForEach(Sub(r) r(“Category”)=“Ready”)
Now write the dt1 to excel again
Thanks & Regards,
Nived N
Hi,
FYI, another solution:
dt = dt.AsEnumerable.Select(Function(r) dt.Clone.LoadDataRow({if(r("Status").ToString.Contains("FineOLD"),"Ready",r("Category").ToString),r("Status").ToString},False)).CopyToDataTable
Regards,
Thanks a Lot for your Support Yoichi. Both works Great
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.