Ian Vink
Ian Vink

Reputation: 68750

SQLite Date Query

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.

DateTime 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.

Upvotes: 0

Views: 436

Answers (1)

Darin Dimitrov
Darin Dimitrov

Reputation: 1038780

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

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

Upvotes: 3

Related Questions