Reputation: 11961
I would like to get two columns like SoccerStatus, SoccerDate from the SoccerAvailability
in SQLite database into a list where SoccerDate="Today" using LINQ query ? I have tried the below query, but its throws exception, I need CurrentDate alone, no time is needed in my query.
List<SoccerAvailability> myList = (from x in conn.Table<SoccerAvailability>().Where(x => x.CurrentDate == DateTime.Now.ToString("ddMMyyyy")) select x).ToList();
Unhandled Exception:
SQLite.SQLiteException: no such function: tostring
Upvotes: 1
Views: 643
Reputation: 89102
convert the current date to a string before you execute your query
var currentDate = DateTime.Now.ToString("ddMMyyyy");
List<SoccerAvailability> myList = (from x in conn.Table<SoccerAvailability>().Where(x => x.CurrentDate == currentDate) select x).ToList();
Upvotes: 3