still getting error
better ro use the line breaks for easier reading as well
As mentioned above and pre-announced
means , we cant resolve in c#?
@MitheshBolla ,
I think the keywords need to be exact when specified in C#.
Could you try the below :
(from d in DT.AsEnumerable()
where sheetNames.Any(x => x.Contains(d["USCIS Case Status"].ToString().Trim()))
select d).CopyToDataTable();
This worked bro ,For copying list of status from array to new sheet.
to delete the same list of arry in same Main sheet ie : DT?
(from d in DT.AsEnumerable()
where sheetNames.Any(x => x.Contains(d[āUSCIS Case Statusā].ToString().Trim()))
select d).CopyToDataTable();
Delete, delete is not working i checked.
The query which u have provided for me is to filter in dt and add to new sheet and also i need to delete those filtered rows in my main sheet.
will remove work?
(from d in DT.AsEnumerable()
where sheetNames.Any(x => x.Remove(d[āUSCIS Case Statusā].ToString().Trim()))
select d).CopyToDataTable();
For Updating the Excel Sheet by Deleting the Filtered rows, we can first get the Filtered rows which does not match the condition. Meaning the reverse of the First Query. We can get the filtered rows using the below Query.
(from d in DT.AsEnumerable()
where !sheetNames.Any(x =>x.Contains(d["USCIS Case Status"].ToString().Trim()))
select d).CopyToDataTable();
It is the same Query, except we are using a !
operator (Not) which reverses the condition and it will able us to get the Non-Matching rows.
Now, To Update the Excel Sheet, we could first clear the entire rows in the sheet and then write the Filtered rows into it.
For clearing the entire sheet, we could use a Write Cell
Activity as mentioned in the Post below.
Then use Write Range
Activity to write the filtered Datatable to this Sheet Starting from A2
.
Thanks Bro ,
In this Post i had got solutions for the list below.
- Passing arrylist to filter data table
- filtering datatable with arrylist c# code
3)deleting filtered arraylist in datatable with c# code.
Thank you all for your help.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.