我正尝试通过以下代码从数据库打印特定记录的详细信息
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;
问题是,当我运行程序时,quickreport显示数据库中的所有记录,而不是仅使用edit1.text打印记录。换句话说,运行的报告类似于只键入
procedure TReportsForm.BitBtn1Click(Sender: TObject);
begin
singlememberreportform.QuickRep1.Preview;
end;
对这个问题有什么想法吗?