(From d In ResDT_Ori.AsEnumerable
Let chk1 = St_Arr_keyword.Any(Function (k1) d(“Description”).toString.Trim.Contains(k1))
Let chk2 = St_Arr_keyword3.Any(Function (k2) d(“Outplus”).toString.Trim.Contains(k2))
Where {chk1,chk2}.All(Function (b) b)
Select r=d).CopyToDataTable
If(
(From d In ResDT_Ori.AsEnumerable
Let chk1 = St_Arr_keyword3.Any(Function (k1) d("Description").toString.Trim.Contains(k1))
Let chk2 = St_Arr_keyword3.Any(Function (k2) d("Outplus").toString.Trim.Contains(k2))
Where {chk1,chk2}.All(Function (b) b)
Select r=d).Count.Equals(0),
_
Nothing,
_
(From d In ResDT_Ori.AsEnumerable
Let chk1 = St_Arr_keyword3.Any(Function (k1) d("Description").toString.Trim.Contains(k1))
Let chk2 = St_Arr_keyword3.Any(Function (k2) d("Outplus").toString.Trim.Contains(k2))
Where {chk1,chk2}.All(Function (b) b)
Select r=d).CopyToDataTable
)
In case there is an option that the result will be empty I use following approach:
1/ I store the result in Array(of DataRow) - array could be empty - using .ToArray method instead of .CopyToDataTable
2/ I check the array.count > 0
3/ if array is not empty I copy array to datatable