procedure LoadGridColumn(strUser,strTableName:string);
var
qrytemp:Tadoquery;
inti:Integer;
begin
qrytemp:=tadoquery.Create(nil);
try
DBGrid.Selected.Clear;
qrytemp.Connection:=DataForm.ADOConn;
qrytemp.SQL.Clear;
qrytemp.SQL.Add('select * from PubDBGridStyle where PubLoginUser='''+strUser+''' and PubTableName='''+strTableName+'''');
qrytemp.Open;
qrytemp.First;
for inti:=0 to qrytemp.RecordCount-1 do
begin
DBGrid.Selected.Add(qrytemp.FieldByName('PubKeyName').AsString+#9+
qrytemp.FieldByName('PubDisWidth').AsString+#9+
qrytemp.FieldByName('PubDisName').AsString);
qrytemp.Next;
end;
DBGrid.ApplySelected;
finally
qrytemp.Free;
end;
end;我写了一个LoadGridColumn用来把WWDBGRID的来设置列宽和列标题显示,但是如果我按钮点的快了,就会出错
出错内容
list index out of bound(2)
var
qrytemp:Tadoquery;
inti:Integer;
begin
qrytemp:=tadoquery.Create(nil);
try
DBGrid.Selected.Clear;
qrytemp.Connection:=DataForm.ADOConn;
qrytemp.SQL.Clear;
qrytemp.SQL.Add('select * from PubDBGridStyle where PubLoginUser='''+strUser+''' and PubTableName='''+strTableName+'''');
qrytemp.Open;
qrytemp.First;
for inti:=0 to qrytemp.RecordCount-1 do
begin
DBGrid.Selected.Add(qrytemp.FieldByName('PubKeyName').AsString+#9+
qrytemp.FieldByName('PubDisWidth').AsString+#9+
qrytemp.FieldByName('PubDisName').AsString);
qrytemp.Next;
end;
DBGrid.ApplySelected;
finally
qrytemp.Free;
end;
end;我写了一个LoadGridColumn用来把WWDBGRID的来设置列宽和列标题显示,但是如果我按钮点的快了,就会出错
出错内容
list index out of bound(2)
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货