I was watching a linq tutorial video and following his steps
His linq query looked like this
The purpose of this query is to remove rows whose Country column is empty
I followed his same steps and same query but I am getting an error
Can anyone let me the reason for this error, it would be very helpful.
rlgandu
(Rajyalakshmi Gandu)
October 6, 2023, 4:35am
2
@Mohammad.Fuad
Left side: dtFiltered (a new DataTable variable)=
YourDataTableVar.AsEnumerable().Where(Function(row) Not String.IsNullOrEmpty(row(“Country”).ToString.Trim)).CopyToDataTable
Please try this
When I used your linq, I got this error
Try this @Mohammad.Fuad
(
From row In dt_1
Where Not String.IsNullOrEmpty(row(“Country”).ToString)
Select row).copyToDataTable
1 Like
@Mohammad.Fuad
type the expression manually don’t copy and paste it
(
From row In dt
Where Not String.IsNullOrEmpty(row(“country”).tostring)
Select row
).copytodatatable
cheers
1 Like
Thanks a lot dude, it worked.
can you tell me why that error occurs?
1 Like
Gokul001
(Gokul Balaji)
October 6, 2023, 4:51am
10
Hi @Mohammad.Fuad
Try with expression
(
From row In dt_1
Where Not String.IsNullOrEmpty(row("Country").ToString)
Select row).copyToDataTable
Mohammad.Fuad:
For this error you need to re enter the Double quote
in the expression
Regards
Gokul
1 Like
system
(system)
Closed
October 9, 2023, 9:07am
12
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.