关于循环条件的,小问题. ACCESS+DELPHI情况,我想求得数据库的第一条记录,和最后一条记录的编号,然后根据记录编号从第一条到最后一条进行循环替换库是的字段数据.问题1:不知如何求得第一和最后一条的记录号,问题2:循环如何写,谢了. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 首先:建议采用自动编号主键ID来示标识记录,此为数据表的唯一编号,一般中不存在什么记录号的;其次:建议采用主键ID排序,采用UPDATE语句来修改数据,用一个循环也可以,但效率比较低。 你说的记录号是指什么?如果你想得到第一条和最后一条记录中字段的内容,用table1.first;table1.last;就可以了! table1.first;table1.last;for i:=0 to recordecount-1 dobegin...end;while not table1.eof dobegin...next;end; table1.open;table1.First;while not table1.eof dobegin {在此内可以取table1的记录};end; with adotable1 dobegin open; while not eof do begin //你的语句 next; end;end; 加个自动编号 字段select min(自动编号字段) from 表select max(自动编号字段) from 表 同意: qizhanfeng(glacier) 的观点或 然后根据编号order by select * from table order by id while adoquery1.eof dobegin 你的语句 Next;end; table1.open;table1.First;while not table1.eof dobegin table1.edit; table1.fieldbyname('').asstring="内容"; table1.post; table1. next;end; 求助:delphi能否把数据库操作单独作为一个文件 帮忙看一下返回值的形式 使用ADODataSet的问题,很弱! 请教编写输入法软件的问题 保护动物团体指控肯德基供应商残忍对待鸡只[转帖] 请问谁有delphi5开发人员指南的光盘 DBEdit控件是对应数据库的某一个字段,但是有个问题:它会把记录中的空格都显示出来,要去掉其中的空格,并修改其中的记录,该怎么做? 准备学Delphi,大家给点好的建议! 上机评分代码怎么写!!!快帮帮我 谁能介绍检测内存泄漏方面的软件? 插入记录 关于uft8decode函数不能正常解码的问题,急!
其次:建议采用主键ID排序,采用UPDATE语句来修改数据,用一个循环也可以,但效率比较低。
table1.last;for i:=0 to recordecount-1 do
begin
.
.
.
end;while not table1.eof do
begin
.
.
.
next;
end;
table1.First;
while not table1.eof do
begin
{在此内可以取table1的记录};
end;
with adotable1 do
begin
open;
while not eof do
begin
//你的语句
next;
end;end;
select min(自动编号字段) from 表
select max(自动编号字段) from 表
或 然后根据编号order by
select * from table order by id while adoquery1.eof do
begin
你的语句
Next;
end;
table1.First;
while not table1.eof do
begin
table1.edit;
table1.fieldbyname('').asstring="内容";
table1.post;
table1. next;
end;