[後端] 修改transaction scope 問題

This commit is contained in:
dev02 2023-09-13 15:15:57 +08:00
parent bf1133311d
commit a7afe09ac1

View File

@ -1199,8 +1199,8 @@ SET FOREIGN_KEY_CHECKS = 1;";
//}
#endregion
StringBuilder sb = new StringBuilder();
int count = 0;
#region import_niagara_item資料表
foreach (var row in ds)
{
@ -1221,6 +1221,16 @@ device_floor_tag, device_master_tag, device_last_name_tag, device_serial_tag, d
row.isHistory + ", now() " +
");";
sb.Append(ss);
count++;
if (count == 100)
{
using (TransactionScope scope = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled))
{
await conn.ExecuteAsync(sb.ToString());
}
sb.Clear();
count = 0;
}
}
if (sb.Length > 0)
{