[後端] 修改transaction scope 問題
This commit is contained in:
parent
bf1133311d
commit
a7afe09ac1
@ -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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user