LINQ/LAMBDA filter query by date [on hold]
- by inquisitive_one
I'm trying to use LINQ to SQL to retrieve earnings data for a particular date range. Currently the table is set up as follows:
Comp Eps Year Quarter
IBM .5 2012 2
IBM .65 2012 3
IBM .60 2012 4
IBM .5 2011 2
IBM .7 2013 1
IBM .8 2013 2
Except for Eps, all fields have a data type of string or char. Eps has a data type of double.
Here's my code:
var myData = myTable
.Where(t => t.Comp.Equals("IBM")
&&
Convert.Int32(string.Format("{0}{1}", t.Year, t.Quarter)) <= 20131);
I get the following error when I tried that code:
Method 'System.String Format(System.String, System.Object, System.Object)' has no supported translation to SQL
How can I select all Eps that has a year & quarter less than "20132" using a lambda expression?