I have a datatable with columns like First Name, Middle Name, Last Name. I need to filter the records in C# for a condition like shown below.
Select * From Table Where LastName >= 'john'
How to apply this where condition and get the filtered results set that will have records whose last names are like John, Justine, K*****, L***, M***.....Z*** ( last names from J to Z as per alphabetical order)
This datatable is populated by executing a stored procedure and I can't apply the filter at stored proc level as data is encrypted in backend.
I'm able to get the results for equality operator using the below logic.
e.g.
SQL vesion: Select * From Table Where LastName like '%john%'
C# version:
var employees = ( from e in dtEmployee.AsEnumerable()
where e.Field("LastName").Contains("john")
select e ).ToList();
where e.Field
select e ).ToList();
Similarly, need to use the >= operator. How to get records for this filter condition? Can anyone please help on this?
Tapan PatelPosted Sep 27, 2017, 2:55 PM
Amit GuptaPosted Sep 27, 2017, 2:40 PM
Khan Abrar AhmedPosted Sep 27, 2017, 6:46 AM
Ankit SharmaPosted Sep 27, 2017, 4:01 AM
Tapan PatelPosted Sep 26, 2017, 5:02 PM
Sri RamPosted Sep 26, 2017, 3:29 PM
Thank you Ankit for your support.
Unfortunately, the stackoverflow solution doesn't filter records correctly..
Ankit SharmaPosted Sep 26, 2017, 10:29 AM