为什么使用 RecNo 过滤打印不起作用???(50分)

  • 主题发起人 主题发起人 ppppgp
  • 开始时间 开始时间
P

ppppgp

Unregistered / Unconfirmed
GUEST, unregistred user!
我编写的一个应用程序需要打印指定范围内的数据库记录 但是我使用
Table 的过滤特性来实现时 发现过滤没有起到应有的效果 例指如下:
我 设定范围是 8 到 16
我使用 Table 的 Table1FilterRecord 事件进行过滤打印 我使用的
是QReport3.05 条件为:if Table1.RecNo>=8 and Table1.RecNo<
=16 then Accept:=true else Accept :=false; 但是过滤的结果却
是没有找到任何记录! 这是什么原因呢???
希望能够得到指点!!!谢谢!!!
 
RecNo is only for Paradox and dbase,not for other database

1.
property RecNo: Longint;

Description

Examine RecNo to determine the record number of the current record in the dataset. Applications might use this property with RecordCount to iterate through all the records in a dataset, though typically record iteration is handled with calls to First, Last, MoveBy, Next, and Prior.

Note: If accessing Paradox tables, RecNo can be set to a specific record number to position the cursor on that record.

2.
function IsSequenced: Boolean; override;

Description

Call IsSequenced to determine whether database records can be located by sequence numbers. When IsSequenced is True, the dataset can navigate directly to a specific record by setting the RecNo property. If IsSequenced is False, the only way to navigate to a specific record is to start at the beginning and count records.
 
RecNo is only for Paradox and dbase,not for other database

1.
property RecNo: Longint;

Description

Examine RecNo to determine the record number of the current record in
the dataset. Applications might use this property with RecordCount to
iterate through all the records in a dataset, though typically record
iteration is handled with calls to First, Last, MoveBy, Next, and
Prior.

Note: If accessing Paradox tables, RecNo can be set to a specific
record number to position the cursor on that record.

2.
function IsSequenced: Boolean; override;


Description


Call IsSequenced to determine whether database records can be located
by sequence numbers. When IsSequenced is True, the dataset can
navigate directly to a specific record by setting the RecNo property.
If IsSequenced is False, the only way to navigate to a specific
record is to start at the beginning and count records.
 
条件中不能用delphi对象中的field值,应该用数据库字段表示
 
TO Victortim:
我使用的就是 Paradox 数据库 事实上我使用调试的时候发现 如果条件是
从 1 开始的 即从第一条记录开始 则正确显示哪个是可以的 但是打印的结
果却是恰好多出一条记录 如果是从其它开始 则一般是不正确的 是不是不能
够使用 RecNo 来过滤?有BUG ???
TO Pipi:
能够更加详细一些吗???能够举个例子吗???
 
换个方法:

var StartRec,endRec,curRec:integer;

procedure TForm1.QuickRep1BeforePrint(Sender: TCustomQuickRep;
var PrintReport: Boolean);
begin
Start:=0;
endRec:=8;
curRec:=Start;
Table1.first;
if Table1.MoveBy(Start)=Start then
PrintReport:=True;
end;

procedure TForm1.QuickRep1NeedData(Sender: TObject; var MoreData: Boolean);
begin
MoreDate:=true;
if curRec>EndRec then
begin
MoreDate:=False
exit;
end;
if Start<>curRec then
if Table.moveby(1)<>1 then
MoreDate:=False;
inc(curRec);
end;
 
to Victortim :
如果我的程序的范围并不是我在上述举例时的 而是要根据一定的其它条件
来进行过滤的 这种方法是否并不好? 而且我是指使用 recno 来过滤不正
常的 也就是说我并不一定指打印过滤 能否进一步指点一下呢?
谢谢!!!
 
最好不要使用 RecNo() 过滤,宁可多增加一个标志字段,事先找出符合条件的记录,然后做上标记。
 
多人接受答案了。
 
后退
顶部