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
@ -76,19 +76,24 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
using (var cmd = cn.CreateCommand())
|
using (var cmd = cn.CreateCommand())
|
||||||
{
|
{
|
||||||
cmd.CommandText = this.Context.Insertable(dictionary.First()).AS(dt.TableName).ToSql().Key.Replace(";SELECT LAST_INSERT_ROWID();","");
|
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)
|
foreach (DataRow dataRow in dt.Rows)
|
||||||
{
|
{
|
||||||
|
int correctParameterIndex = 0;
|
||||||
foreach (DataColumn item in dt.Columns)
|
foreach (DataColumn item in dt.Columns)
|
||||||
{
|
{
|
||||||
if (IsBoolTrue(dataRow, item))
|
if (isCorrectErrorSqlParameterName)
|
||||||
{
|
{
|
||||||
cmd.Parameters.AddWithValue("@" + item.ColumnName, true);
|
if (!cmd.CommandText.Contains("@" + item.ColumnName))
|
||||||
}
|
{
|
||||||
else if (IsBoolFalse(dataRow, item))
|
cmd.Parameters.AddWithValue($"@CrorrPara{correctParameterIndex}", dataRow[item.ColumnName]);
|
||||||
{
|
correctParameterIndex++;
|
||||||
cmd.Parameters.AddWithValue("@" + item.ColumnName, false);
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cmd.Parameters.AddWithValue("@" + item.ColumnName, dataRow[item.ColumnName]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user