为什么用table就可以 用adotable就不行呢?

cruise007 2006-01-23 05:15:44
下面是我在做报表的时候想实现报表分页的功能 但是在统计数据的时候我发现 用bde里面的table1连数据库的时候qrTest.DataSet.RecordCount 是正确的 但是如果换成ado里面的adotable1连数据库时qrTest.DataSet.RecordCount 就出错请问各位高手是什么原因呢?




小弟这里感谢了


procedure TqrTest.ChildBand1BeforePrint(Sender: TQRCustomBand;
var PrintBand: Boolean);
begin
if PrintCount >= qrTest.DataSet.RecordCount then
PrintBand := True
else
PrintBand := False;
end;
...全文
155 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
人鱼传说 2006-02-04
  • 打赏
  • 举报
回复
学习
cruise007 2006-02-03
  • 打赏
  • 举报
回复
错误信息是
‘access violation at address 004e6945 in module ‘project1.exe’. read of address 00000000’
耙子 2006-02-03
  • 打赏
  • 举报
回复
我记得有个版本的Delphi的RecordCount的帮助上面写着,它只能保证Paradox和DBF数据返回的结果是正确的,其他可能返回的是-1。

不建议你使用这个属性,应该用Select count(*) from xxxx来返回。
如果一定要用,那么之前先用

begin
qrTest.DataSet.Last; // 把所有的数据都读进来,如果表很大可能会慢
if PrintCount >= qrTest.DataSet.RecordCount then
PrintBand := True
else
PrintBand := False;
end;
NightCloud 2006-01-24
  • 打赏
  • 举报
回复
报什么错。
如果可以,先加上
qrTest.dataSet.first试试;
procedure TqrTest.ChildBand1BeforePrint(Sender: TQRCustomBand;
var PrintBand: Boolean);
begin
qrTest.DataSet.first;
if PrintCount >= qrTest.DataSet.RecordCount then
PrintBand := True
else
PrintBand := False;
end;
zhangl_cn 2006-01-24
  • 打赏
  • 举报
回复
把出错信息贴出来

2,498

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 数据库相关
社区管理员
  • 数据库相关社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧