改为如下: adotable1.first; // added statement for i:=1 to adotable1.recordcount do begin with adotable1 do begin edit; adotable1.fields[1]='更新‘; post; next; // added statement end; end;
adotable1.first; while not adotable1.Eof do begin with adotable1 do begin edit; adotable1.fields[1]='更新‘; post; next; end; end;
你的代码: for i:=1 to adotable1.recordcount do begin with adotable1 do begin edit; adotable1.fields[1]='更新‘; post; end; end;你没有先用AdoTable.First才出现越界错误.而且你还没有用Next移动这个指针,上面程序的结果是数据库的指针已经出界(可能是被你前面的程序改的)或者反复改相同的一条纪录.skimwater(掠水惊鸿)和wangxd1976(西门吹雪) 的例子应该没有问题!!
adotable1.first; // added statement
for i:=1 to adotable1.recordcount do
begin
with adotable1 do
begin
edit;
adotable1.fields[1]='更新‘;
post;
next; // added statement
end;
end;
while not adotable1.Eof do
begin
with adotable1 do
begin
edit;
adotable1.fields[1]='更新‘;
post;
next;
end;
end;
因为我的adotable 中,使用了过滤条件,不方便使用sql语句。
谢谢几位的关注,我试试,如果能行,一定给分
for i:=1 to adotable1.recordcount do
begin
with adotable1 do
begin
edit;
adotable1.fields[1]='更新‘;
post;
end;
end;你没有先用AdoTable.First才出现越界错误.而且你还没有用Next移动这个指针,上面程序的结果是数据库的指针已经出界(可能是被你前面的程序改的)或者反复改相同的一条纪录.skimwater(掠水惊鸿)和wangxd1976(西门吹雪) 的例子应该没有问题!!