码迷,mamicode.com
首页 > 数据库 > 详细

不用SQL给打印记录编号

时间:2014-12-03 08:09:26      阅读:189      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   io   ar   os   sp   for   on   

以QUICKREPORT为例

页面设置如下:

bubuko.com,布布扣

其中ID为编号。

设置为表的ID字段。

 

QUICKREPORT所在的FORM添加一个变量:

var
FprnT6: TFprnT6;
Vxh:integer; //编号变量

 

公开一个方法,用以设置变量的初始值:

public
{ Public declarations }
procedure Setxh(Axh:integer);

 

procedure TFprnT6.Setxh(Axh:integer);
begin
Vxh:=Axh;
end;

 

在ID的ONPRINT方法添加如下代码:
procedure TFprnT6.QRPDBText1Print(sender: TObject; var Value: string);
begin
Vxh:=Vxh+1;
Value:=inttostr(Vxh);
end;

 

 

控制打印主程序如下:


procedure TFCountMain.DoCountT6(Gtitle,GTdate:string);
var
sqlstr:string;
begin

Application.CreateForm(TFprnT6, FprnT6);
FprnT6.QRLtitle.Caption:=Gtitle;
FprnT6.QRLreportdate.Caption:=GTdate;
FprnT6.Setxh(0); //序号清零
sqlstr:=‘select * from Tperson ‘;
dm.LoadPersonBySql(sqlstr);//提取数据记录
FprnT6.QuickRep1.Print;

end;

 

不用SQL给打印记录编号

标签:style   blog   http   io   ar   os   sp   for   on   

原文地址:http://www.cnblogs.com/happyhills/p/4139070.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!