With AdoQ Do
Begin
Close;
Sql.Clear;
Sql.Add('Select * From Abc');
Open;
End;
If Not Adoq.IsEmpty Then
Begin
I:=1;
While Not Adoq.Eof Do
Begin
StringGrid1.Cells[0,I]:=IntToStr(I);
StringGrid1.Cells[1,I]:=AdoQ['Lx'];
StringGrid1.Cells[2,I]:=AdoQ['Bs'];
StringGrid1.Cells[3,I]:=AdoQ['Dwmc'];
Adoq.Next;
End;
End;
AdoQ.Close;
Adoq.Sql.Clear;这是一段嵌在DLL中的代码,为什么运行到AdoQ.Close就报错?
错误如下:Bof或Eof中有一个有"真",或当前的记录已被删除,所需的操作需要一个当前记录.
运行情况是这样的,表中有二条记录,但StringGrid1中只显示了一条,循环已经运行完了,为什么只显示一条呢?DELPHI5.0 Ado的补丁我已经打了呀!!!!各位大虾救命啊
Begin
Close;
Sql.Clear;
Sql.Add('Select * From Abc');
Open;
End;
If Not Adoq.IsEmpty Then
Begin
I:=1;
While Not Adoq.Eof Do
Begin
StringGrid1.Cells[0,I]:=IntToStr(I);
StringGrid1.Cells[1,I]:=AdoQ['Lx'];
StringGrid1.Cells[2,I]:=AdoQ['Bs'];
StringGrid1.Cells[3,I]:=AdoQ['Dwmc'];
Adoq.Next;
End;
End;
AdoQ.Close;
Adoq.Sql.Clear;这是一段嵌在DLL中的代码,为什么运行到AdoQ.Close就报错?
错误如下:Bof或Eof中有一个有"真",或当前的记录已被删除,所需的操作需要一个当前记录.
运行情况是这样的,表中有二条记录,但StringGrid1中只显示了一条,循环已经运行完了,为什么只显示一条呢?DELPHI5.0 Ado的补丁我已经打了呀!!!!各位大虾救命啊
解决方案 »
- 获取硬盘物理序列号的delphi2010源码
- 外婆,一路走好!555555555555555555555555555555555555555555555
- 一道面试题目
- [押宝游戏][有大庄友情赞助2w分,压得越多,赚得越多]上证A股从6000点一路跌到现在,最后几个交易日,来一次押宝游戏
- 三层 dcom配置,客户端提示: interface not supported
- adoquery查询结果,处理后,更新的问题,非高手莫进,高分,在线等ing;
- 自身的劣根性是中国的第一大仇人,日本是中国的第二大仇人。
- 怎样做一个类似网上邻居的程序?
- ♂◇◆♂◇◆在DFW没人能答的贴子♂◇◆♂◇◆谁能回答500分相送!
- 一个简单的问题:我在主菜单定义快捷键无效
- 在Delphi里怎么调用和Win32SDK同名函数?
- 解决问题者,重分相谢!
Begin
Close;
Sql.Clear;
Sql.Add('Select * From Abc');
Open;
End;
if Adoq.recordcount <= 0 then
begin
Adoq.close;
exit;
end;
for i := 0 to Adoq.recordcount - 1 do
begin
StringGrid1.Cells[0,I+1] = IntToStr(I+1);
StringGrid1.Cells[1,I+1]:=AdoQ['Lx'];
StringGrid1.Cells[2,I+1]:=AdoQ['Bs'];
StringGrid1.Cells[3,I+1]:=AdoQ['Dwmc'];
Adoq.Next;
end;
Adoq.close;try it
改为
if (Not ADOQ.IsEmpty) and (Not ADOQ.Eof) then
试试
While Not Adoq.Eof Do
Begin
StringGrid1.Cells[0,I]:=IntToStr(I);
StringGrid1.Cells[1,I]:=AdoQ['Lx'];
StringGrid1.Cells[2,I]:=AdoQ['Bs'];
StringGrid1.Cells[3,I]:=AdoQ['Dwmc'];
Adoq.Next;
inc(i); //加上就好了
End;
Begin
Close;
Sql.Clear;
Sql.Add('Select * From Abc');
Open; if Adoq.recordcount <= 0 then
begin
Adoq.close;
exit;
end;
for i := 0 to Adoq.recordcount - 1 do
begin
StringGrid1.Cells[0,I+1] = IntToStr(I+1);
StringGrid1.Cells[1,I+1]:=AdoQ['Lx'];
StringGrid1.Cells[2,I+1]:=AdoQ['Bs'];
StringGrid1.Cells[3,I+1]:=AdoQ['Dwmc'];
Adoq.Next;
end;end;
Adoq.close;
Begin
Close;
Sql.Clear;
Sql.Add('Select * From ABC');
Open;
End;
If (Not Adoq.IsEmpty) And (Not AdoQ.Eof) Then
Begin
I:=1;
// While Not Adoq.Eof Do
For I:=0 To AdoQ.recordcount-1 Do
Begin
StringGrid1.Cells[0,I+1]:=IntToStr(I);
StringGrid1.Cells[1,I+1]:=AdoQ['Lx'];
StringGrid1.Cells[2,I+1]:=AdoQ['Bs'];
StringGrid1.Cells[3,I+1]:=AdoQ['Dwmc'];
// I:=I+1;
Adoq.Next;
End;
End;
AdoQ.Close;
Adoq.Sql.Clear;
这些都不行啊!问题到底在哪?
2 在close前添加first试试
但我只有第二个ADO的更新包,谁有第一个?
Begin
Close;
Sql.Clear;
Sql.Add('Select * From Abc');
Open;
End;
If Not Adoq.eof Then
Begin
I:=1;
While Not Adoq.Eof Do
Begin
StringGrid1.Cells[0,I]:=IntToStr(I);
if (AdoQ['Lx']<>NULL) and (AdoQ['Lx']<>'') then
StringGrid1.Cells[1,I]:=AdoQ['Lx'];
if (AdoQ['Bs']<>NULL) and (AdoQ['Bs']<>'') then
StringGrid1.Cells[2,I]:=AdoQ['Bs'];
if (AdoQ['Dwmc']<>NULL) and (AdoQ['Dwmc']<>'') then
StringGrid1.Cells[3,I]:=AdoQ['Dwmc'];
Adoq.Next;
End;
End;
AdoQ.Close;
Adoq.Sql.Clear;
borland的bug:)