下面代码将'xName'填充到ListBox1中:
AdoQuery1.cursortype:=ctOpenForwardOnly;
AdoQuery1.LockType:=ltReadOnly;
AdoQuery1.CacheSize:=1000;
ListBox1.Items.Clear;
with AdoQuery1 do
begin
Close;
SQL.Text:='select xName from Table1 where ...';
Open;
while not eof do
begin
ListBox1.Items.Add(FieldByName('xName').AsString);
Next;
end;
end;
当RecordCount较大时,将需要很长时间(20000条记录超过8秒,而使用C#中的DataReader遍历仅2秒
AdoQuery1.cursortype:=ctOpenForwardOnly;
AdoQuery1.LockType:=ltReadOnly;
AdoQuery1.CacheSize:=1000;
ListBox1.Items.Clear;
with AdoQuery1 do
begin
Close;
SQL.Text:='select xName from Table1 where ...';
Open;
while not eof do
begin
ListBox1.Items.Add(FieldByName('xName').AsString);
Next;
end;
end;
当RecordCount较大时,将需要很长时间(20000条记录超过8秒,而使用C#中的DataReader遍历仅2秒
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货