var builder = new SqlBuilder();
var sqlQuery = @"Select * From xxxxTable /**where**/";
var template = builder.AddTemplate(sqlQuery);
builder.Where("xxx1= @xxx1", new { xxx1= xxx1});
builder.Where("convert(date,xxx2) < convert(date,GETDATE())"); // compare with sql server current date is Okay!
builder.Where("convert(date,xxx3) < convert(date,@xxx3)", new {xxx3 = xxx3}); // compare with parameter date is not okay!
using (var connection = Db.GetConnection(xx_ConnectionString_xx))
{
return connection.Query<xxModel>(template.RawSql,template.Parameters).FirstOrDefault();
}
对比较日期时间列值的 SqlBuilder使用有任何想法。
谢谢....