admin管理员组

文章数量:1291044

when trying to open a query (TFDQuery) at runtime, i got the following error "décalage 5CCD". Any idea about the meaning of this error ?

The query is created at runtime, including SQL, Connection and params. While debugging, i can see that all seems correct, but on the line with the "Open" instruction, it crashes.

Tia

synthetic code:

FormCreate:

  RqAdresse := TFDQuery.Create(Self);
  
  with RqAdresse do
  begin
    Connection := UGlobal.DatabaseConn;
    Name       := 'RqAdresse';

    with SQL do
    begin
      Add('select Field1, Field2, Field3 ');
      Add('From MyTable ');
      Add('where aParam = :aParam ');
      Add('order by Field1');
    end;

    AfterOpen  := RqAdresseAfterOpen;
    AfterClose := RqAdresseAfterClose;
  end;

MyButtonClick:

  With RqAdresse do
  begin
    if Active then
      Close;  
      
    Params.Params[0].AsString := '459050';

    try
      Open; // crash here !

    except
      On E: Exception do
      begin
        ShowMessage(E.Message + ' ' + SQL.Text);
      end;
    end;
  end;

FormDestroy:

  if Assigned(RqAdresse) then
  try
    RqAdresse.Close;
    RqAdresse.SQL.Clear;
    RqAdresse.Params.Clear;
    FreeAndNil(RqAdresse);

  except
    RqAdresse := nil;
  end;

procedure RqAdresseAfterOpen(DataSet: TDataSet);
begin
  with DataSet do
  begin
    RqAdresseFIELD1  := FieldByName(StrFIELD1);
    RqAdresseFIELD2  := FieldByName(StrFIELD2);
    ...
    RqAdresseFIELDn  := FieldByName(StrFIELDn);
  end;
    
  // Update columns to show in the GRID later on.
  MAJColsInGrid;
end;

本文标签: Delphi 12Oracle 19CFireDac and error opening a queryStack Overflow