Last post Jul 11, 2017 11:36 AM by ehsansajjad465
Jul 11, 2017 11:18 AM|gani7787|LINK
I am checking and returning boolean value. But, it is returning always false.
MyInParameter : "APPLE"
My table Column
Actually there is a word "APPLE" will be there in Col1. It should suppose to return "TRUE".
But, it will return false. any problem in my LINQ query.
below my LINQ Query
bool Result1 = DTRes.AsEnumerable().Any(row => MyInParameter == row.Field<String>("Col1"));
what is the problem in my query..?
Jul 11, 2017 11:36 AM|ehsansajjad465|LINK
You current linq query is checking for exact match of APPLE with the datatable values while in the datable you don't have exact
APPLE string but it contains other characters as well, you need to use
Contains method of String here :
bool Result1 = DTRes.AsEnumerable().Any(row => row.Field<String>("Col1").Contains(MyInParameter));
Hope it solves your problem.