Documentation()--->Trigger OnRun()--->Trigger tSQLCommit := 'COMMIT;'; iTeller := 0; bolDelete := FALSE; IF NOT ISCLEAR(adoCon) THEN IF adoCon.State <> 0 THEN adoCon.Close; CLEAR(adoCon); CREATE(adoCon); recSynchroParams.RESET; IF recSynchroParams.GET() THEN bolDelete := recSynchroParams."Delete Lines"; adoCon.Open(cunSynchroFunctions.GetConnString); recSynchroBuffer.RESET; recSynchroBuffer.SETCURRENTKEY(Executed); recSynchroBuffer.SETFILTER(Executed,'%1',FALSE); recSynchroBuffer.LOCKTABLE; IF recSynchroBuffer.FIND('-') THEN BEGIN REPEAT IF (STRPOS(UPPERCASE(recSynchroBuffer.Part1),'DELETE') <> 0) OR (STRPOS(UPPERCASE(recSynchroBuffer.Part1),'INSERT') <> 0) THEN COMMIT; tSQL := recSynchroBuffer.Part1 + recSynchroBuffer.Part2 + recSynchroBuffer.Part3 + recSynchroBuffer.Part4; tSQL += recSynchroBuffer.Part5; tSQL2 := recSynchroBuffer.Part6 + recSynchroBuffer.Part7 + recSynchroBuffer.Part8 + recSynchroBuffer.Part9; tSQL2 += recSynchroBuffer.Part10; adoCon.Execute(tSQL+tSQL2); adoCon.Execute(tSQLCommit); IF bolDelete THEN BEGIN recSynchroBuffer.DELETE; END ELSE BEGIN recSynchroBuffer.Executed := TRUE; recSynchroBuffer.MODIFY; END; iTeller += 1; IF iTeller MOD 100 = 0 THEN BEGIN COMMIT; SLEEP(200); END ELSE IF (STRPOS(UPPERCASE(recSynchroBuffer.Part1),'DELETE') <> 0) OR (STRPOS(UPPERCASE(recSynchroBuffer.Part1),'INSERT') <> 0) THEN COMMIT; recSynchroBuffer.LOCKTABLE; UNTIL NOT recSynchroBuffer.FIND('-'); COMMIT; END; COMMIT; adoCon.Close; CLEAR(adoCon); ErrorHandler()--->Trigger adoCon.Close; CLEAR(adoCon); recSynchroBuffer.Executed := TRUE; recSynchroBuffer.Error := TRUE; recSynchroBuffer.MODIFY;
Answers
what version of Nav are you using?
Thanks.
Is it on the same database OR different DB and are they all Nav?
My Blog - nav.education
//adoCon.Execute(tSQLCommit).