一个简单问题?(10分)

  • 主题发起人 主题发起人 Fucool
  • 开始时间 开始时间
F

Fucool

Unregistered / Unconfirmed
GUEST, unregistred user!
self.ADOQuery1.SQL.Clear ();
self.ADOQuery1.SQL.Add( 'select * from 人员详细信息');
self.ADOQuery1.Active := True;

screen.Cursor := crHourGlass ;
if self.StatusBar1.SimplePanel = true then self.StatusBar1.SimpleText :=' 正在编码,请稍候... ... ';

showmessage(inttostr(ADOQuery1.Recordset.RecordCount));
ADOQuery1.Recordset.MoveFirst ;
for i := 1 to ADOQuery1.Recordset.RecordCount do
begin

pdfstr := ADOQuery1.Recordset.Fields.Item[0].Value + ',' + ADOQuery1.Recordset.Fields.Item[3].Value + ',' ;
ADOQuery1.Recordset.MoveNext ;
showmessage(pdfstr);
end;
这段代码老是出错,信息为“BOF或EOF中有一个是真,或者当前的记录已被删除。。。。所需的操作需要一个当前
的记录”
为什么???
 
补充D6+sP2
如下代码也是一样

while not ADOQuery1.Recordset.EOF do
begin
pdfstr := ADOQuery1.Recordset.Fields.Item[0].Value + ',' + ADOQuery1.Recordset.Fields.Item[3].Value + ',' ;
//showmessage(ADOQuery1.Recordset.Fields.Item[3].Value );
ADOQuery1.Recordset.MoveNext ;
showmessage(pdfstr);
end;
谢谢
 
ADOQuery1.Recordset.MoveFirst ;
for i := 1 to ADOQuery1.Recordset.RecordCount do
begin

pdfstr := ADOQuery1.Recordset.Fields.Item[0].Value + ',' + ADOQuery1.Recordset.Fields.Item[3].Value + ',' ;
ADOQuery1.Recordset.MoveNext ;
showmessage(pdfstr);
end;
这段不行
 
谢谢:土土,
不行,试了,
我的MDAC也升级过,现在是2.6版本
主要问题是第一个记录没有处理,我仔细查了一下。
 
对这是delphi的bug +SP2
 
如果是D5
必须升级ado
delphi网站两个补丁
 
D6+SP2,不知为何还出现这个问题
 
为什么不把所有的ADOQuery1.Recordset中的“Recordset”Cancel掉
 
补充,记着也请将MoveNext该为Next试试看
 
分數少.....


self.ADOQuery1.SQL.Clear ();
self.ADOQuery1.SQL.Add( 'select * from 人员详细信息');
self.ADOQuery1.Active := True;

screen.Cursor := crHourGlass ;
if self.StatusBar1.SimplePanel = true then self.StatusBar1.SimpleText :=' 正在编码,请稍候... ... ';

showmessage(inttostr(ADOQuery1.Recordset.RecordCount));
ADOQuery1.Recordset.MoveFirst ;
for i := 1 to ADOQuery1.Recordset.RecordCount do
begin

pdfstr := ADOQuery1.Recordset.Fields.Item[0].Value + ',' + ADOQuery1.Recordset.Fields.Item[3].Value + ',' ;

if ADOQuery1.Recordset.eof then
break
else
ADOQuery1.Recordset.MoveNext ;
showmessage(pdfstr);
end;
 
多人接受答案了。
 
后退
顶部