我想从SQLite数据库中的SoccerAvailability
中获得两列,例如SoccerStatus,SoccerDate到列表中,其中使用LINQ查询的SoccerDate =“ Today”?我已经尝试了以下查询,但是它抛出异常,我只需要CurrentDate,查询中就不需要时间。List<SoccerAvailability> myList = (from x in conn.Table<SoccerAvailability>().Where(x => x.CurrentDate == DateTime.Now.ToString("ddMMyyyy")) select x).ToList();
未处理的异常:
SQLite.SQLiteException:没有此类函数:tostring
最佳答案
在执行查询之前将当前日期转换为字符串
var currentDate = DateTime.Now.ToString("ddMMyyyy");
List<SoccerAvailability> myList = (from x in conn.Table<SoccerAvailability>().Where(x => x.CurrentDate == currentDate) select x).ToList();
关于sqlite - SQLite.SQLiteException:没有这样的功能:在获取CurrentDate时使用LINQ查询来字符串化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55988614/