开发者

SQLite Date Query

开发者 https://www.devze.com 2023-02-07 17:56 出处:网络
I am trying to get all the records for a child in a date range, but I am getting nothing, making be believe I am constructing the Query wrong.

I am trying to get all the records for a child in a date range, but I am getting nothing, making be believe I am constructing the Query wrong.

DateT开发者_运维知识库ime t = child.DOB.AddMonths (36);
string sql = "
  select * from MeasurementEntity 
  where ChildFK=? and date<=? order by date";
var q = db.Query<MeasurementEntity> (sql,child.PK, t.ToShortDateString ());

This is C#, but that doesn't matter as to the answer.


Maybe there's a problem with the datatime format. Try using ISO8601:

var q = db.Query<MeasurementEntity>(sql,child.PK, t.ToString("s"));
0

精彩评论

暂无评论...
验证码 换一张
取 消