我在一个报表中需要显示一个公司的职工人数,报表单元代码如下:unit U_sumemployee;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, QRCtrls, QuickRpt, adodb,db,ExtCtrls;type
TF_sumemployee = class(TForm)
QuickRep1: TQuickRep;
DetailBand1: TQRBand;
QRShape10: TQRShape;
QRShape1: TQRShape;
QRShape2: TQRShape;
QRShape3: TQRShape;
QRShape8: TQRShape;
QRShape9: TQRShape;
QRShape5: TQRShape;
QRShape6: TQRShape;
QRShape4: TQRShape;
QRShape11: TQRShape;
QRShape12: TQRShape;
QRLabel2: TQRLabel;
QRLabel3: TQRLabel;
QRLabel4: TQRLabel;
QRLabel5: TQRLabel;
QRLabel6: TQRLabel;
QRMemo1: TQRMemo;
QRLabel7: TQRLabel;
QRLabel8: TQRLabel;
QRLabel9: TQRLabel;
QRShape7: TQRShape;
QRShape13: TQRShape;
QRShape14: TQRShape;
QRShape15: TQRShape;
QRShape16: TQRShape;
QRShape17: TQRShape;
QRDBText1: TQRDBText;
TitleBand1: TQRBand;
QRLabel1: TQRLabel;
procedure QuickRep1Preview(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
F_sumemployee: TF_sumemployee;
adoq_sum:TADOQuery;
implementationuses DM_parameter_set;{$R *.dfm}procedure TF_sumemployee.QuickRep1Preview(Sender: TObject);
begin
adoq_sum:=TADOQuery.Create(self);
adoq_sum.Connection:=parameter_set_DM.ADOConnection1;
adoq_sum.Close;
adoq_sum.SQL.Clear;
adoq_sum.SQL.Add('select count(*) as sum from shzf.employee');
adoq_sum.Open;
QRDBText1.DataSet:=adoq_sum;//显示职工人数
QRDBText1.DataField:='sum';
end;end.当我执行F_sumemployee.QuickRep1.Preview;时,这个报表窗体不能显示。当去掉
procedure TF_sumemployee.QuickRep1Preview(Sender: TObject);
begin
adoq_sum:=TADOQuery.Create(self);
adoq_sum.Connection:=parameter_set_DM.ADOConnection1;
adoq_sum.Close;
adoq_sum.SQL.Clear;
adoq_sum.SQL.Add('select count(*) as sum from shzf.employee');
adoq_sum.Open;
QRDBText1.DataSet:=adoq_sum;
QRDBText1.DataField:='sum';
end;
事件时,这个报表窗体能显示出来,但我的查询语句就没有地方执行了,这究竟是为什么????
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, QRCtrls, QuickRpt, adodb,db,ExtCtrls;type
TF_sumemployee = class(TForm)
QuickRep1: TQuickRep;
DetailBand1: TQRBand;
QRShape10: TQRShape;
QRShape1: TQRShape;
QRShape2: TQRShape;
QRShape3: TQRShape;
QRShape8: TQRShape;
QRShape9: TQRShape;
QRShape5: TQRShape;
QRShape6: TQRShape;
QRShape4: TQRShape;
QRShape11: TQRShape;
QRShape12: TQRShape;
QRLabel2: TQRLabel;
QRLabel3: TQRLabel;
QRLabel4: TQRLabel;
QRLabel5: TQRLabel;
QRLabel6: TQRLabel;
QRMemo1: TQRMemo;
QRLabel7: TQRLabel;
QRLabel8: TQRLabel;
QRLabel9: TQRLabel;
QRShape7: TQRShape;
QRShape13: TQRShape;
QRShape14: TQRShape;
QRShape15: TQRShape;
QRShape16: TQRShape;
QRShape17: TQRShape;
QRDBText1: TQRDBText;
TitleBand1: TQRBand;
QRLabel1: TQRLabel;
procedure QuickRep1Preview(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
F_sumemployee: TF_sumemployee;
adoq_sum:TADOQuery;
implementationuses DM_parameter_set;{$R *.dfm}procedure TF_sumemployee.QuickRep1Preview(Sender: TObject);
begin
adoq_sum:=TADOQuery.Create(self);
adoq_sum.Connection:=parameter_set_DM.ADOConnection1;
adoq_sum.Close;
adoq_sum.SQL.Clear;
adoq_sum.SQL.Add('select count(*) as sum from shzf.employee');
adoq_sum.Open;
QRDBText1.DataSet:=adoq_sum;//显示职工人数
QRDBText1.DataField:='sum';
end;end.当我执行F_sumemployee.QuickRep1.Preview;时,这个报表窗体不能显示。当去掉
procedure TF_sumemployee.QuickRep1Preview(Sender: TObject);
begin
adoq_sum:=TADOQuery.Create(self);
adoq_sum.Connection:=parameter_set_DM.ADOConnection1;
adoq_sum.Close;
adoq_sum.SQL.Clear;
adoq_sum.SQL.Add('select count(*) as sum from shzf.employee');
adoq_sum.Open;
QRDBText1.DataSet:=adoq_sum;
QRDBText1.DataField:='sum';
end;
事件时,这个报表窗体能显示出来,但我的查询语句就没有地方执行了,这究竟是为什么????
解决方案 »
- TreeView1 怎么删除掉某个节点呀???
- 求助..信号! 关于过程循环的问题 70 分相送 通宵等答..
- 请教高手,下拉框中如何取当前系统的年月?
- 如何实现用网页的方式调用窗体!!急急急!!
- ado问题!!!!!
- 我下载不到badcopy pro正式版,只下了个评估版(evaluation version),所以明明修复好的文件确保存不了,真痛苦!不知哪位大虾肯相助?
- 汉译英,谁会啊?就一句话
- 一个简单的菜鸟问题,救命!300分
- 如何根据类名创建类实例?
- BMP文件的读写程序中的bfType='MB'
- 各位老师,给菜鸟点DELPI的资料!
- 有谁可以给我一个GetThreadTimes的例子吗?
QuickRep1BeforePrint(Sender: TObject);