IF (STRPOS(LOWERCASE(Company.Name), 'prueba') = 0) AND (STRPOS(LOWERCASE(Company.Name), 'test') = 0) AND (STRPOS(LOWERCASE(Company.Name), 'uat') = 0) AND (STRPOS(LOWERCASE(Company.Name), 'prova') = 0) THEN BEGIN recWasteHeader.CHANGECOMPANY(Company.Name); IF recWasteHeader.COUNT > 0 THEN BEGIN recWasteLine.SETRANGE("Document Type", 4); recWasteLine.SETRANGE("Business Type", 2); recWasteLine.SETFILTER("Sub Contract No.", '<>%1', '*NUL*'); IF recWasteLine.FINDSET THEN BEGIN IF ISCLEAR(sqlConnection) THEN CREATE(sqlConnection, FALSE, FALSE); sqlConnection.Open(ConnectionString); IF ISCLEAR(sqlCommand) THEN CREATE(sqlCommand, FALSE, FALSE); sqlCommand.ActiveConnection := sqlConnection; sqlCommand.CommandText := 'DELETE FROM [Noc Services Price] WHERE Empresa=' + q + Company.Name + q; sqlCommand.CommandType := 1; sqlCommand.Execute; REPEAT querydata := STRSUBSTNO(dataset, Company.Name, recWasteLine."Document No.", recWasteLine."Line No.", recWasteLine.Amount); sqlCommand.CommandText := 'INSERT INTO [Noc Services Price] (Empresa, Contracte, [Linea contracte], [PREU ACTUAL]) VALUES ( ' + querydata + ');'; sqlCommand.Execute; UNTIL recWasteLine.NEXT = 0; sqlConnection.Close; END; END; END;
Answers
Blog - rockwithnav.wordpress.com/
Twitter - https://twitter.com/RockwithNav
Facebook - https://facebook.com/rockwithnav/