diff --git a/Repository/BackendRepository/Implement/NiagaraDataSynchronizeRepository.cs b/Repository/BackendRepository/Implement/NiagaraDataSynchronizeRepository.cs index fe49b52..cce94f4 100644 --- a/Repository/BackendRepository/Implement/NiagaraDataSynchronizeRepository.cs +++ b/Repository/BackendRepository/Implement/NiagaraDataSynchronizeRepository.cs @@ -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) {