Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/71.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# SQLite日期查询_C#_Sql_Sqlite - Fatal编程技术网

C# SQLite日期查询

C# SQLite日期查询,c#,sql,sqlite,C#,Sql,Sqlite,我试图获取日期范围内一个孩子的所有记录,但什么也得不到,让人相信我构造的查询是错误的 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.ToShortDat

我试图获取日期范围内一个孩子的所有记录,但什么也得不到,让人相信我构造的查询是错误的

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 ());
DateTime t=child.DOB.AddMonths(36);
字符串sql=”
从Measurementity中选择*

其中ChildFK=?和date可能是数据时间格式有问题。请尝试使用ISO8601:

var q = db.Query<MeasurementEntity>(sql,child.PK, t.ToString("s"));
var q=db.Query(sql、child.PK、t.ToString(“s”);
数据时间格式可能有问题。请尝试使用ISO8601:

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