try
DModuleGrid.ZQuery1.Close;
DModuleGrid.ZQuery1.SQL.Clear;
DModuleGrid.ZQuery1.SQL.Add('SELECT * FROM tdcupant');
DModuleGrid.ZQuery1.SQL.Add('WHERE numcupom = :co2 AND ccf = :cc3 AND dtcompra = :dtc4 AND impcaixa = :ip5');
DModuleGrid.ZQuery1.ParamByName('co2').AsString := copy(lTemp,53,6);
DModuleGrid.ZQuery1.ParamByName('cc3').AsString := copy(lTemp,47,6);
DModuleGrid.ZQuery1.ParamByName('ip5').AsString := copy(lTemp,4,20);
DModuleGrid.ZQuery1.ParamByName('dtc4').AsDate := StrToDate(dtcompratxt);
DModuleGrid.ZQuery1.Open;
except
on e: Exception do
begin
ercp := e.Message;
StatusBar1.Panels[0].Text := 'Erro ao encontrar registros! ' + ercp;
end;
I think it's right. However, it indicates the error of sql
itself.
Well, the error it gives is:
To be precise, it only needs to catch an exception if none of the records that I compared to the parameters are found in the database.