diff --git a/Src/Asp.Net/SqlSugar/ExpressionsToSql/DbMethods/DefaultDbMethod.cs b/Src/Asp.Net/SqlSugar/ExpressionsToSql/DbMethods/DefaultDbMethod.cs index bde8a84a7..f10ab5894 100644 --- a/Src/Asp.Net/SqlSugar/ExpressionsToSql/DbMethods/DefaultDbMethod.cs +++ b/Src/Asp.Net/SqlSugar/ExpressionsToSql/DbMethods/DefaultDbMethod.cs @@ -901,9 +901,13 @@ namespace SqlSugar } } //Regex regex = new Regex("\@"); - if (sql.EndsWith(" =)")) + if (!sql.Contains("@")) { sql = sql.Replace(" =)", $" = {newValue})"); + if (!sql.Contains(newValue)) + { + sql = sql.Replace(" )", $" = {newValue})"); + } } else {