Browse Source

Update Access

pull/40/head
sunkaixuan 1 year ago
parent
commit
2088e34461
  1. 7
      Src/Asp.NetCore2/SqlSugar.AccessCore/Access/SqlBuilder/AccessExpressionContext.cs
  2. 8
      Src/Asp.NetCore2/SqlSugar/Abstract/DeleteProvider/DeleteableProvider.cs

7
Src/Asp.NetCore2/SqlSugar.AccessCore/Access/SqlBuilder/AccessExpressionContext.cs

@ -23,6 +23,13 @@ namespace SqlSugar.Access
public override string ToDate(MethodCallExpressionModel model) public override string ToDate(MethodCallExpressionModel model)
{ {
var parameter = model.Args[0]; var parameter = model.Args[0];
if (parameter.MemberName?.ToString()?.Contains(":")==true
&& parameter.MemberName?.ToString()?.Contains("-") == true
&&parameter.MemberName?.ToString()?.StartsWith("'") == true)
{
parameter.MemberName ="'"+ parameter.MemberName.ToString()
.ToString().TrimEnd('\'').TrimStart('\'').ObjToDate().ToString("yyyy-MM-dd HH:mm:ss")+"'";
}
return string.Format(" CDate({0}) ", parameter.MemberName); return string.Format(" CDate({0}) ", parameter.MemberName);
} }
public override string ToBool(MethodCallExpressionModel model) public override string ToBool(MethodCallExpressionModel model)

8
Src/Asp.NetCore2/SqlSugar/Abstract/DeleteProvider/DeleteableProvider.cs

@ -184,10 +184,10 @@ namespace SqlSugar
{ {
andString.AppendFormat("\"{0}\"={1} ", primaryField.ToLower(), new PostgreSQLExpressionContext().GetValue(entityValue)); andString.AppendFormat("\"{0}\"={1} ", primaryField.ToLower(), new PostgreSQLExpressionContext().GetValue(entityValue));
} }
//else if (this.Context.CurrentConnectionConfig.DbType == DbType.SqlServer && entityValue != null && UtilMethods.GetUnderType(entityValue.GetType()) == UtilConstants.DateType) else if ( entityValue != null &&UtilMethods.IsNumber( UtilMethods.GetUnderType(entityValue.GetType()).Name))
//{ {
// andString.AppendFormat("[{0}]={1} ", primaryField, $"'{entityValue.ObjToDate().ToString("yyyy-MM-dd HH:mm:ss.fff")}'"); andString.AppendFormat("[{0}]={1} ", primaryField, $"{entityValue}");
//} }
else if (entityValue != null && UtilMethods.GetUnderType(entityValue.GetType()) == UtilConstants.DateType) else if (entityValue != null && UtilMethods.GetUnderType(entityValue.GetType()) == UtilConstants.DateType)
{ {
andString.AppendFormat("{0}={1} ", this.SqlBuilder.GetTranslationColumnName(primaryField), this.DeleteBuilder.LambdaExpressions.DbMehtods.ToDate(new MethodCallExpressionModel() andString.AppendFormat("{0}={1} ", this.SqlBuilder.GetTranslationColumnName(primaryField), this.DeleteBuilder.LambdaExpressions.DbMehtods.ToDate(new MethodCallExpressionModel()

Loading…
Cancel
Save