DataSource.DataSet:=ADOQuery;
ADOQuery.ConnectionString:=DBConnectStr;
ADOQuery.sql.clear;
ADOQuery.sql.AddStrings(DBSQLCommand);
ADOQuery.Active:=True;
DBShow.ColCount:=ADOQuery.fielddefs.Count;
DBShow.RowCount:=DataSource.DataSet.RecordCount+1;
for i:=0 to ADOQuery.fielddefs.Count-1 do
begin
Application.ProcessMessages;
DBShow.Cells[i,0]:=ADOQuery.fielddefs[i].Name;
DBShow.ColWidths[i]:=12*length(trim(MainForm.NetWorkParaShowStringGrid.Cells[i,0]));
end;
j:=0;
ADOQuery.First;
while not ADOQuery.eof do
begin
j:=j+1;
Application.ProcessMessages;
for i:=0 to DataSource.DataSet.fielddefs.Count-1 do
begin
Application.ProcessMessages;
DBShow.Cells[i,j]:=ADOQuery.Fields.Fields[i].AsString;
end;
ADOQuery.Next;
MainForm.RzStatusPane.Caption:=inttostr(j-1);
end;
if Assigned(ADOQuery) then ADOQuery.free;
if Assigned(DataSource) then DataSource.free;
end;