diff --git a/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/DbMethods/DefaultDbMethod.cs b/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/DbMethods/DefaultDbMethod.cs index 0849774a3..eaed612d9 100644 --- a/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/DbMethods/DefaultDbMethod.cs +++ b/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/DbMethods/DefaultDbMethod.cs @@ -141,7 +141,15 @@ namespace SqlSugar } else { - inValues.Add(item); + if (item is string &&item.HasValue() && model?.Conext?.SugarContext?.Context?.CurrentConnectionConfig?.DbType == DbType.MySql) + { + var newValue= item.ToString().Replace("\\", "\\\\"); + inValues.Add(newValue); + } + else + { + inValues.Add(item); + } } } }