mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-05-15 20:49:31 +08:00
Synchronization code
This commit is contained in:
parent
f5f72c1631
commit
39a09fd445
@ -77,18 +77,23 @@ namespace SqlSugar
|
||||
using (var cmd = cn.CreateCommand())
|
||||
{
|
||||
cmd.CommandText = this.Context.Insertable(dictionary.First()).AS(dt.TableName).ToSql().Key.Replace(";SELECT LAST_INSERT_ROWID();", "");
|
||||
|
||||
var isCorrectErrorSqlParameterName = this.Context?.CurrentConnectionConfig?.MoreSettings?.IsCorrectErrorSqlParameterName == true;
|
||||
foreach (DataRow dataRow in dt.Rows)
|
||||
{
|
||||
int correctParameterIndex = 0;
|
||||
foreach (DataColumn item in dt.Columns)
|
||||
{
|
||||
if (IsBoolTrue(dataRow, item))
|
||||
if (isCorrectErrorSqlParameterName)
|
||||
{
|
||||
cmd.Parameters.AddWithValue("@" + item.ColumnName, true);
|
||||
if (!cmd.CommandText.Contains("@" + item.ColumnName))
|
||||
{
|
||||
cmd.Parameters.AddWithValue($"@CrorrPara{correctParameterIndex}", dataRow[item.ColumnName]);
|
||||
correctParameterIndex++;
|
||||
}
|
||||
else if (IsBoolFalse(dataRow, item))
|
||||
else
|
||||
{
|
||||
cmd.Parameters.AddWithValue("@" + item.ColumnName, false);
|
||||
cmd.Parameters.AddWithValue("@" + item.ColumnName, dataRow[item.ColumnName]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user