你可以这样, adoquery.frist; while not adoquery.eof do begin xxxxx adoquery.next; end;
for i:=1 to ADOQuery.RecordCount do begin string1:=//第i行2列数据 string2:=//第i行3列数据 { 其他处理代码 } end;
adoquery.frist; while not adoquery.eof do begin string1:=adoquery.fields[0].asstring; string2:=adoquery.fields[1].asstring; //////嫌麻烦 用for循环 for i:=0 to adoquery.fields.count-1 do begin adoquery.next; end;
谢谢风之谷,我试过了,在处理最后加上ADOQuery.Next就对了.
adoquery.frist; while not adoquery.eof do begin //读取数据库 adoquery.next; end; { 修改数据: adoquery.edit; //修改数据程序 adoquery.post; 添加数据: adoquery.Insert; //添加数据程序[也可用SQL操作] adoquery.post }
with adoquery1 do begin close; sql.clear; sql.add('...'); sql.open; if recordcount >0 then begin while not eof do begin fields[i].asstring; // i是第几列; next; end; end;
adoquery.frist;
while not adoquery.eof do
begin
xxxxx
adoquery.next;
end;
for i:=1 to ADOQuery.RecordCount do
begin
string1:=//第i行2列数据
string2:=//第i行3列数据
{
其他处理代码
}
end;
while not adoquery.eof do
begin
string1:=adoquery.fields[0].asstring;
string2:=adoquery.fields[1].asstring;
//////嫌麻烦 用for循环
for i:=0 to adoquery.fields.count-1 do
begin
adoquery.next;
end;
while not adoquery.eof do
begin
//读取数据库
adoquery.next;
end;
{
修改数据:
adoquery.edit;
//修改数据程序
adoquery.post;
添加数据:
adoquery.Insert;
//添加数据程序[也可用SQL操作]
adoquery.post
}
begin
close;
sql.clear;
sql.add('...');
sql.open; if recordcount >0 then
begin
while not eof do
begin
fields[i].asstring; // i是第几列;
next;
end;
end;