1

我正在尝试通过以下代码从数据库中打印特定记录的详细信息

procedure TReportsForm.BitBtn1Click(Sender: TObject);
begin
  if edit1.Text = '' then
  begin
    ShowMessage('Please enter the serial number first');
    Edit1.SetFocus;
  end
  else
  begin
    with AddIndividualsAccountADOQuery do
    begin
      SQL.Clear;
      SQL.Add('Select * from IndividualAccount where [Serial Number]=:Sno');
      Parameters.ParamByName('Sno').Value:=edit1.Text;
      Open;
      Active := True;
      singlememberreportform.QuickRep1.Preview;
    end;

    if AddIndividualsAccountADOQuery.RecordCount = 0 then
    begin
      ShowMessage('Empty Jonathan database to view records.');
    end
  end;
end;

问题是当我运行程序时,快速报告显示数据库中的所有记录,而不是只打印带有 edit1.text 的记录。换句话说,运行的报告类似于只键入

procedure TReportsForm.BitBtn1Click(Sender: TObject); 
begin
  singlememberreportform.QuickRep1.Preview;
end;

对这个问题有任何想法吗?

4

0 回答 0