Z
zhaoxuncai
Unregistered / Unconfirmed
GUEST, unregistred user!
我用CRYSTAL REPORTS 10 设计报表,因设计需要在大报表中要套小报表,也就是subreport ,reports和subreport 的database field都设为sql 中所对应的的table
程式如下:
begin
adoquery2.Close;
adoquery2.SQL.Clear;
adoquery2.SQL.Add('select orders.*,paper.*,prints.*,process.*,packaging.* from orders inner join format on orders.order_no=format.order_no ');
adoquery2.SQL.Add('inner join paper on orders.order_no=paper.order_no inner join prints on orders.order_no=prints.order_no ');
adoquery2.SQL.Add('inner join process on orders.order_no=process.order_no inner join packaging on orders.order_no=packaging.order_no ');
adoquery2.SQL.Add('where orders.order_no='''+edit1.text+'''');
adoquery2.Open;
if opendialog1.execute then
begin
crpe1.Connect.Clear;
Crpe1.connect.ServerName:= 'mingtai-server';
Crpe1.connect.DatabaseName:= 'mingtai';
crpe1.Connect.UserID:= 'sa';
crpe1.connect.Password:= '';
crpe1.ReportName:=opendialog1.filename;
Crpe1.Connect.Propagate := True;
crpe1.DiscardSavedData;
try
crpeds1.dataset:=adoquery2;
crpe1.Tables[0].DataPointer:=crpeds1.datapointer;
screen.Cursor:=crhourglass;
// crpe1.ParamFields[0].ShowDialog := False;
// crpe1.ParamFields[0].CurrentValue := pubworkname;
crpe1.execute;
finally
screen.Cursor:=crdefault;
end;
end;
当我打印时,我只想我选择的工单出来,但在subreport中所有的数据资料都显示出来,包含我不需要的,而我已经crpe1.Tables[0].DataPointer:=crpeds1.datapointer 我并没有设save data with report
请问各位是为什么?
谢谢!
程式如下:
begin
adoquery2.Close;
adoquery2.SQL.Clear;
adoquery2.SQL.Add('select orders.*,paper.*,prints.*,process.*,packaging.* from orders inner join format on orders.order_no=format.order_no ');
adoquery2.SQL.Add('inner join paper on orders.order_no=paper.order_no inner join prints on orders.order_no=prints.order_no ');
adoquery2.SQL.Add('inner join process on orders.order_no=process.order_no inner join packaging on orders.order_no=packaging.order_no ');
adoquery2.SQL.Add('where orders.order_no='''+edit1.text+'''');
adoquery2.Open;
if opendialog1.execute then
begin
crpe1.Connect.Clear;
Crpe1.connect.ServerName:= 'mingtai-server';
Crpe1.connect.DatabaseName:= 'mingtai';
crpe1.Connect.UserID:= 'sa';
crpe1.connect.Password:= '';
crpe1.ReportName:=opendialog1.filename;
Crpe1.Connect.Propagate := True;
crpe1.DiscardSavedData;
try
crpeds1.dataset:=adoquery2;
crpe1.Tables[0].DataPointer:=crpeds1.datapointer;
screen.Cursor:=crhourglass;
// crpe1.ParamFields[0].ShowDialog := False;
// crpe1.ParamFields[0].CurrentValue := pubworkname;
crpe1.execute;
finally
screen.Cursor:=crdefault;
end;
end;
当我打印时,我只想我选择的工单出来,但在subreport中所有的数据资料都显示出来,包含我不需要的,而我已经crpe1.Tables[0].DataPointer:=crpeds1.datapointer 我并没有设save data with report
请问各位是为什么?
谢谢!