我有上万条的记录由于实际需要需要用到stringgrid控件!然而每次往里面添加纪录的时候都非常慢!
例如:
StringGrid1.Cells[1,i]:=ADOQuery1.FieldByName('aa').AsString;
。
有什么更好的其他办法可以提升速度呢?请高人指点!
例如:
StringGrid1.Cells[1,i]:=ADOQuery1.FieldByName('aa').AsString;
。
有什么更好的其他办法可以提升速度呢?请高人指点!
解决方案 »
- 早上上班路上和土地爷亲密接触了下,来分享下
- Oh~Ye 猩猩大变身,可以吃香蕉了 (笑.............)
- ■■■■■■■关于treeview逐级展开的问题!
- 请问在如何获得一个表的列数以及一个数据库中表的个数。
- 急!installshield4.0 for delphi做安装程序的怪一现象?
- 如果让2001/07的这样字符型,自动加一个月,变成2001/08呢,请指教....
- 数据库的备份?恢复?
- 可用分是什么意思?大家的可用分有多少?
- 请高手指教!!!!!如解决必酬谢.
- dephi6有没有adoexpress的升级包??我想要。。。。
- 郁闷:为Excel做的Addin DLL文件,在excel打开后,使用正常,但在excel退出时有异常提示
- 如何将一个窗体封装成PANEL
//首先设定PageSize,取出PageCount
procedure TForm1.Button1Click(Sender: TObject);
begin
ADoquery1.Recordset.PageSize :=spinedit1.Value;
Edit1.Text := IntToStr(ADoquery1.Recordset.PageCount);
ShowData(spinedit2.Value);
end;
//然后将AbsolutePage的数据乾坤大挪移到StringGrid1中
procedure TForm1.ShowData(page:integer);
var
iRow, iCol, iCount : Integer;
rs : ADOInt.Recordset;
begin
ADoquery1.Recordset.AbsolutePage:=Page;
Currpage:=page;
iRow := 0;
iCol := 1;
stringgrid1.Cells[iCol, iRow] := 'FixedCol1';
Inc(iCol);
stringgrid1.Cells[iCol, iRow] := 'FixedCol2';
Inc(iRow);
Dec(iCol);
rs := adoquery1.Recordset;
for iCount := 1 to SpinEdit1.Value do
begin
stringgrid1.Cells[iCol, iRow] := rs.Fields.Get_Item('FieldName1').Value;
Inc(iCol);
stringgrid1.Cells[iCol, iRow] := rs.Fields.Get_Item('FieldName1').Value;
Inc(iRow);
Dec(iCol);
rs.MoveNext;
end;
//上一页
procedure TForm1.Button2Click(Sender: TObject);
begin
If (CurrPage)<>1 then
ShowData(CurrPage-1);
end;
//下一页
procedure TForm1.Button3Click(Sender: TObject);
begin
If CurrPage<>ADoquery1.Recordset.PageCount then
ShowData(CurrPage+1);
end;