哦! 那我的代码:(上一条)按纽的代码 begin if query1.Eof=true then begin query1.First; button6.Enabled:=false; button7.Enabled:=false; end else begin query1.Prior; button6.Enabled:=true; button7.Enabled:=true; edit1.Text:=query1.FieldValues['编号']; edit2.Text:=query1.FieldValues['名称']; edit3.Text:=query1.FieldValues['金额']; memo1.Text:=query1.FieldValues['备注']; end; 怎么不能实现查询上一条记录呢? 麻烦高手指点!
begin if query1.Bof=true then begin query1.Last; button6.Enabled:=false; button7.Enabled:=false; end else begin query1.Prior; button6.Enabled:=true; button7.Enabled:=true; edit1.Text:=query1.FieldValues['编号']; edit2.Text:=query1.FieldValues['名称']; edit3.Text:=query1.FieldValues['金额']; memo1.Text:=query1.FieldValues['备注']; end;
那我的代码:(上一条)按纽的代码
begin
if query1.Eof=true then
begin
query1.First;
button6.Enabled:=false;
button7.Enabled:=false;
end
else
begin
query1.Prior;
button6.Enabled:=true;
button7.Enabled:=true;
edit1.Text:=query1.FieldValues['编号'];
edit2.Text:=query1.FieldValues['名称'];
edit3.Text:=query1.FieldValues['金额'];
memo1.Text:=query1.FieldValues['备注'];
end;
怎么不能实现查询上一条记录呢?
麻烦高手指点!
if query1.Bof=true then
begin
query1.Last;
button6.Enabled:=false;
button7.Enabled:=false;
end
else
begin
query1.Prior;
button6.Enabled:=true;
button7.Enabled:=true;
edit1.Text:=query1.FieldValues['编号'];
edit2.Text:=query1.FieldValues['名称'];
edit3.Text:=query1.FieldValues['金额'];
memo1.Text:=query1.FieldValues['备注'];
end;
好象是反了
BOF是判断是否是第一条记录
EOF是判断是否是最后一条记录