- 修复 SqlServer 未处理字符串前面加N 的 bug;

This commit is contained in:
28810
2019-07-17 09:57:39 +08:00
parent ecffd9840a
commit a5f524d154
11 changed files with 13 additions and 12 deletions

View File

@ -34,7 +34,9 @@ namespace FreeSql.SqlServer
param = Utils.GetDataReaderValue(mapType, param);
if (param is bool || param is bool?)
return (bool)param ? 1 : 0;
else if (param is string || param is char)
else if (param is string)
return string.Concat("N'", param.ToString().Replace("'", "''"), "'");
else if (param is char)
return string.Concat("'", param.ToString().Replace("'", "''"), "'");
else if (param is Enum)
return ((Enum)param).ToInt64();
@ -59,7 +61,6 @@ namespace FreeSql.SqlServer
foreach (var z in ie) sb.Append(",").Append(AddslashesProcessParam(z, mapType));
return sb.Length == 0 ? "(NULL)" : sb.Remove(0, 1).Insert(0, "(").Append(")").ToString();
}
else if (param is string) return string.Concat("N'", param.ToString().Replace("'", "''"), "'");
return string.Concat("'", param.ToString().Replace("'", "''"), "'");
}