我做了一个程序,是一个图书管理程序,有三个数据库,学生库,图书库,借阅库,现生成一个预定报表,该报表从借阅库中获得预定名单,从其他两个库获得相关详细信息,但现在生成的表只有一项,而库中符合情况的有5条纪录,这是什么原因????unit Unit10;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, QuickRpt, ExtCtrls, QRCtrls;
type
TForm10 = class(TForm)
quickrep1: TQuickRep;
TitleBand1: TQRBand;
ColumnHeaderBand1: TQRBand;
DetailBand1: TQRBand;
QRSubDetail1: TQRSubDetail;
GroupHeaderBand1: TQRBand;
QRSubDetail2: TQRSubDetail;
GroupHeaderBand2: TQRBand;
QRLabel1: TQRLabel;
QRSubDetail3: TQRSubDetail;
GroupHeaderBand3: TQRBand;
QRLabel8: TQRLabel;
QRLabel9: TQRLabel;
QRLabel10: TQRLabel;
QRLabel11: TQRLabel;
QRLabel12: TQRLabel;
QRLabel13: TQRLabel;
QRDBText1: TQRDBText;
QRLabel2: TQRLabel;
QRLabel3: TQRLabel;
QRDBText2: TQRDBText;
QRDBText3: TQRDBText;
QRDBText4: TQRDBText;
QRDBText5: TQRDBText;
QRDBText6: TQRDBText;
QRDBText7: TQRDBText;
QRDBText8: TQRDBText;
procedure FormActivate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form10: TForm10;
implementation
uses Unit8;
{$R *.dfm}
procedure TForm10.FormActivate(Sender: TObject);
begin {设置数据模块}
with datamodule8.query1 do {设置数据模块的query组件}
begin
close;
{是query组件指向借阅模块中所有被预约的纪录}
databasename:='work';
datasource:=datamodule8.recordds;
sql.clear;
datamodule8.query1.sql.add('select bookno,orderstu,studentno from brecord');
sql.add('where ordered=true');
prepare;
open;
end;
{设置数据模块的studenttable}
with datamodule8.studenttable do
begin
databasename:='work';
tablename:='student.db';
indexfieldnames:='studentno';
masterfields:='orderstu';
mastersource:=datamodule8.queryds
end;
{设置数据模块的booktable}
with datamodule8.booktable do
begin
databasename:='work';
tablename:='book.db';
indexfieldnames:='bookno';
masterfields:='bookno';
mastersource:=datamodule8.queryds;
end;
{使QRDBText1组件指向query1的'orderstu'字段}
with qrdbtext1 do
begin
dataset:=datamodule8.query1;
datafield:='orderstu';
end;
{使QRDBText2组件指向query1的'bookno'字段}
with QRDBText2 do
begin
dataset:=datamodule8.Query1;
datafield:='bookno';
end;
datamodule8.studenttable.open;
datamodule8.booktable.open;
quickrep1.Preview; {报表预览}
end;
end.
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, QuickRpt, ExtCtrls, QRCtrls;
type
TForm10 = class(TForm)
quickrep1: TQuickRep;
TitleBand1: TQRBand;
ColumnHeaderBand1: TQRBand;
DetailBand1: TQRBand;
QRSubDetail1: TQRSubDetail;
GroupHeaderBand1: TQRBand;
QRSubDetail2: TQRSubDetail;
GroupHeaderBand2: TQRBand;
QRLabel1: TQRLabel;
QRSubDetail3: TQRSubDetail;
GroupHeaderBand3: TQRBand;
QRLabel8: TQRLabel;
QRLabel9: TQRLabel;
QRLabel10: TQRLabel;
QRLabel11: TQRLabel;
QRLabel12: TQRLabel;
QRLabel13: TQRLabel;
QRDBText1: TQRDBText;
QRLabel2: TQRLabel;
QRLabel3: TQRLabel;
QRDBText2: TQRDBText;
QRDBText3: TQRDBText;
QRDBText4: TQRDBText;
QRDBText5: TQRDBText;
QRDBText6: TQRDBText;
QRDBText7: TQRDBText;
QRDBText8: TQRDBText;
procedure FormActivate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form10: TForm10;
implementation
uses Unit8;
{$R *.dfm}
procedure TForm10.FormActivate(Sender: TObject);
begin {设置数据模块}
with datamodule8.query1 do {设置数据模块的query组件}
begin
close;
{是query组件指向借阅模块中所有被预约的纪录}
databasename:='work';
datasource:=datamodule8.recordds;
sql.clear;
datamodule8.query1.sql.add('select bookno,orderstu,studentno from brecord');
sql.add('where ordered=true');
prepare;
open;
end;
{设置数据模块的studenttable}
with datamodule8.studenttable do
begin
databasename:='work';
tablename:='student.db';
indexfieldnames:='studentno';
masterfields:='orderstu';
mastersource:=datamodule8.queryds
end;
{设置数据模块的booktable}
with datamodule8.booktable do
begin
databasename:='work';
tablename:='book.db';
indexfieldnames:='bookno';
masterfields:='bookno';
mastersource:=datamodule8.queryds;
end;
{使QRDBText1组件指向query1的'orderstu'字段}
with qrdbtext1 do
begin
dataset:=datamodule8.query1;
datafield:='orderstu';
end;
{使QRDBText2组件指向query1的'bookno'字段}
with QRDBText2 do
begin
dataset:=datamodule8.Query1;
datafield:='bookno';
end;
datamodule8.studenttable.open;
datamodule8.booktable.open;
quickrep1.Preview; {报表预览}
end;
end.
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货