0

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.

1 Answer 1

3

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

var q = db.Query<MeasurementEntity>(sql,child.PK, t.ToString("s"));
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.