一下是timer中的代码
procedure TForm1.tmr1Timer(Sender: TObject);
var
i,j:Integer;begin for i:=2 to 11 do
begin
TLabel(FindComponent('lbl'+inttostr(i))).caption := '';
end;
if qry1.Eof then qry1.First;
i:=2;
while (not qry1.Eof) and (i<12) do begin
TLabel(FindComponent('lbl'+inttostr(i))).caption := qry1.Fields[0].AsString;
i:=i+1;
qry1.Next;
end; for j:=12 to 21 do
begin
TLabel(FindComponent('lbl'+inttostr(j))).Caption:='';
end;
if qry2.Eof then qry2.First;
j:=12;
while (not qry2.Eof) and (j<22) do begin
TLabel(FindComponent('lbl'+inttostr(j))).Caption:='¥'+qry2.Fields[0].AsString;
j:=j+1;
qry2.Next;
end;
数据库数据delphilabel
procedure TForm1.tmr1Timer(Sender: TObject);
var
i,j:Integer;begin for i:=2 to 11 do
begin
TLabel(FindComponent('lbl'+inttostr(i))).caption := '';
end;
if qry1.Eof then qry1.First;
i:=2;
while (not qry1.Eof) and (i<12) do begin
TLabel(FindComponent('lbl'+inttostr(i))).caption := qry1.Fields[0].AsString;
i:=i+1;
qry1.Next;
end; for j:=12 to 21 do
begin
TLabel(FindComponent('lbl'+inttostr(j))).Caption:='';
end;
if qry2.Eof then qry2.First;
j:=12;
while (not qry2.Eof) and (j<22) do begin
TLabel(FindComponent('lbl'+inttostr(j))).Caption:='¥'+qry2.Fields[0].AsString;
j:=j+1;
qry2.Next;
end;
数据库数据delphilabel
解决方案 »
- 求内存流读写组件的状态
- delphi线程中打印报表的问题
- 要使用Hash,找了半天只找到THashedStringList,但是又不能满足要求?难道Delphi没法使用Hash吗?
- access数据库对2个表操作,如何保证操作成功?
- 用power(256,3)求出来的是Extended型,如何把它直接转换成Integer型啊
- 哪位大侠熟悉ScriptControl.Run的参数如何传递的?
- findfirst,findnext,怎么得不到呢,请教
- 音频数据如何播放?
- 请问:动态生成一个按钮后,怎么添加他的CLICK事件?
- 请问如何在一可执行文件中加入代码,举例加一个SHOWMESSAGE
- delphi 7調用codesoft 問題
- 急:Delphi7中调用SQL动态轮询查询数据库导致虚拟内存激增,最终堆栈溢出,如何解决?
所以你的事件里面 应该qry1重新查询,而不是一直用以前的结果集。
明白了吧 加几句代码而已
你在if qry2.Eof then qry1.First;前应该先刷新一下qry2
这样就可以动态的显示增加的数据了。