public void ExecuteSyncIntoTable(List <TableRow> l, Table dest, string postUpdateSQL = null) { try { int intAffected = 0; int nroRegs = 0; int prg = 0; int max = l.Count; SqlQueryGenerator rib = new SqlQueryGenerator(dest.TableInfo, dbType); foreach (TableRow ri in l) { if (ri.DiferentFromDestinaion) { string sql = rib.CreateExcecutionQuery(ri.Data, ri.NotExistsInDestination); try { intAffected += dbConnection.ExecuteSQL(sql); if (!string.IsNullOrEmpty(postUpdateSQL)) { // TODO: It's needed to run on source // bd.ExecuteSQL(rib.getPostUpdate(JobCallBack.PostUpdateSQL)); } } catch (Exception erro) { messageHandler.SendError(erro.Message + " SQL: " + sql); } nroRegs++; prg++; if (prg > 300) { messageHandler.SendStatus(string.Format("Syncing {0}: {1}/{2} (OK: {3} | Errors: {4})", dest.TableInfo.TableName, nroRegs, max, intAffected, (nroRegs - intAffected))); OnProgress(nroRegs, max); prg = 0; } if (Replicator.AbortReplication) { throw new ApplicationException("Aborted"); } } } } catch (ApplicationException) { throw; } catch (Exception e) { messageHandler.SendError(e.Message); } }