From f66d76c4b5d4ec16c03e0211e16cc8881511a9fa Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Mon, 21 Feb 2022 00:34:20 +0800 Subject: [PATCH] Update accress --- .../AccessTest/Demo/Demo1_Queryable.cs | 4 +- Src/Asp.Net/AccessTest/Test.accdb | Bin 528384 -> 532480 bytes .../SqlBuilder/AccessExpressionContext.cs | 50 ++++++++++++++++++ 3 files changed, 52 insertions(+), 2 deletions(-) diff --git a/Src/Asp.Net/AccessTest/Demo/Demo1_Queryable.cs b/Src/Asp.Net/AccessTest/Demo/Demo1_Queryable.cs index 8f3461488..3b139e5ab 100644 --- a/Src/Asp.Net/AccessTest/Demo/Demo1_Queryable.cs +++ b/Src/Asp.Net/AccessTest/Demo/Demo1_Queryable.cs @@ -121,7 +121,7 @@ namespace OrmTest //var test02 = db.Union(q1, q2).ToList(); var test03 = db.Queryable().Take(1).ToList(); var dp = DateTime.Now; - //var test05 = db.Queryable().Where(it => it.CreateTime.Month== dp.Month).ToList(); + var test05 = db.Queryable().Where(it => it.CreateTime.Month== dp.Month).ToList(); var test06 = db.Queryable() .ToPivotTable(it => it.Id, it => it.Name, it => it.Sum(x => x.Price)); @@ -153,7 +153,7 @@ namespace OrmTest JoinType.Left, o.Name == SqlFunc.ToString(SqlFunc.MergeString(",", i.Name, ",")) )) .Select().ToList(); - var test16 = db.Queryable().Select(it => SqlFunc.SqlServer_DateDiff("day", DateTime.Now.AddDays(-1), DateTime.Now)).ToList(); + // var test16 = db.Queryable().Select(it => SqlFunc.SqlServer_DateDiff("day", DateTime.Now.AddDays(-1), DateTime.Now)).ToList(); var test17 = db.Queryable() .Select() diff --git a/Src/Asp.Net/AccessTest/Test.accdb b/Src/Asp.Net/AccessTest/Test.accdb index 8394fe3a8eeb4079a5b78897f804f94b6da42243..47b8c07fee37d90fc993e3bebd53b8cceab95f9e 100644 GIT binary patch delta 4048 zcmZ9OYitzP8HQ(e*B-OBu}QEo#$a=`+hXF&dORMMVb~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p.Net/SqlSugar.Access/Access/SqlBuilder/AccessExpressionContext.cs index ae8ee96f2..f30ecb5ec 100644 --- a/Src/Asp.Net/SqlSugar.Access/Access/SqlBuilder/AccessExpressionContext.cs +++ b/Src/Asp.Net/SqlSugar.Access/Access/SqlBuilder/AccessExpressionContext.cs @@ -20,6 +20,56 @@ namespace SqlSugar.Access } public partial class AccessMethod : DefaultDbMethod, IDbMethods { + public override string ToDate(MethodCallExpressionModel model) + { + var parameter = model.Args[0]; + return string.Format(" CDate({0}) ", parameter.MemberName); + } + public override string ToBool(MethodCallExpressionModel model) + { + var parameter = model.Args[0]; + return string.Format(" CDate({0}) ", parameter.MemberName); + } + public override string ToInt32(MethodCallExpressionModel model) + { + var parameter = model.Args[0]; + return string.Format(" CInt({0}) ", parameter.MemberName); + } + public override string ToString(MethodCallExpressionModel model) + { + var parameter = model.Args[0]; + return string.Format(" CVar({0}) ", parameter.MemberName); + } + public override string ToDateShort(MethodCallExpressionModel model) + { + var parameter = model.Args[0]; + return string.Format(" Format$({0},\"Long Date\") ", parameter.MemberName); + } + public override string DateValue(MethodCallExpressionModel model) + { + var type = ""; + if (model.Args[1].MemberValue.ObjToString() == "Day") + { + type = "d"; + } + if (model.Args[1].MemberValue.ObjToString() == "Month") + { + type = "m"; + } + if (model.Args[1].MemberValue.ObjToString() == "Year") + { + type = "yyyy"; + } + if (model.Args[1].MemberValue.ObjToString() == DateType.Minute.ToString()) + { + type = "M"; + } + if (model.Args[1].MemberValue.ObjToString() == DateType.Second.ToString()) + { + type = "s"; + } + return "DATEPART(\""+ type + "\", date())"; + } public override string GetRandom() { return " rnd() ";