procedure TForm1.Button5Click(Sender: TObject);
var
i,j : integer;
begin
ZConnection1.Database := ComboBox1.Text;
ZConnection1.User := Edit1.Text;
ZConnection1.Password := Edit2.Text;
ZConnection1.Connect;
ZQuery1.SQL.Text := Memo2.Text;
// SELECT * FROM vorgang
ZQuery1.Active := true;
ZQuery1.First;
// Stringgrid leeren
Stringgrid1.ColCount := 1;
Stringgrid1.RowCount := 1;
// Stringgrid auf Anzahl der Ergebnisse anpassen
StringGrid1.ColCount := ZQuery1.FieldCount;
StringGrid1.RowCount := ZQuery1.RecordCount + 1;
// Eine Überschriftenzeile einfügen
Stringgrid1.FixedRows := 1;
//Überschriftenzeile mit den Tabellennamen füllen
for i := 0
to StringGrid1.ColCount - 1
do
Stringgrid1.Cells[i,0] := ZQuery1.Fields[i].FieldName;
// Stringgrid mit Daten aus der Abfrage füllen
for i := 0
to ZQuery1.RecordCount - 1
do
begin
Application.ProcessMessages;
for j := 0
to ZQuery1.FieldCount - 1
do
begin
Case ZQuery1.Fields[j].DataType
of
ftDate:
StringGrid1.Cells[j,i+1] := '
Date field';
ftUnknown:
StringGrid1.Cells[j,i+1] := '
Unknown field';
ftString:
StringGrid1.Cells[j,i+1] := '
String field';
ftSmallint:
StringGrid1.Cells[j,i+1]:='
16-bit integer field';
ftInteger:
StringGrid1.Cells[j,i+1]:='
32-bit integer field';
ftWord:
StringGrid1.Cells[j,i+1]:='
16-bit unsigned integer field';
ftBoolean:
StringGrid1.Cells[j,i+1]:='
Boolean field';
ftFloat:
StringGrid1.Cells[j,i+1]:='
Floating-point numeric field';
ftCurrency:
StringGrid1.Cells[j,i+1]:='
Money field';
ftBCD:
StringGrid1.Cells[j,i+1]:='
Binary-Coded Decimal field';
ftTime:
StringGrid1.Cells[j,i+1]:='
Time field';
ftDateTime:
StringGrid1.Cells[j,i+1]:='
Date and time field';
ftBytes:
StringGrid1.Cells[j,i+1]:='
Fixed number of bytes (binary storage)';
ftVarBytes:
StringGrid1.Cells[j,i+1]:='
Variable number of bytes (binary storage)';
ftAutoInc:
StringGrid1.Cells[j,i+1]:='
Auto-incrementing 32-bit integer counter field';
ftBlob:
StringGrid1.Cells[j,i+1]:='
Binary Large OBject field';
ftMemo:
StringGrid1.Cells[j,i+1]:='
Text memo field';
ftGraphic:
StringGrid1.Cells[j,i+1]:='
Bitmap field';
ftFmtMemo:
StringGrid1.Cells[j,i+1]:='
Formatted text memo field';
ftParadoxOle:
StringGrid1.Cells[j,i+1]:='
Paradox OLE field';
ftDBaseOle:
StringGrid1.Cells[j,i+1]:='
dBASE OLE field';
ftTypedBinary:
StringGrid1.Cells[j,i+1]:='
Typed binary field';
ftCursor:
StringGrid1.Cells[j,i+1]:='
Output cursor from an Oracle stored procedure (TParam only)';
ftFixedChar:
StringGrid1.Cells[j,i+1]:='
Fixed character field';
ftWideString:
StringGrid1.Cells[j,i+1]:='
Wide string field';
ftLargeInt:
StringGrid1.Cells[j,i+1]:='
Large integer field';
ftADT:
StringGrid1.Cells[j,i+1]:='
Abstract Data Type field';
ftArray:
StringGrid1.Cells[j,i+1]:='
Array field';
ftReference:
StringGrid1.Cells[j,i+1]:='
REF field';
ftDataSet:
StringGrid1.Cells[j,i+1]:='
DataSet field';
ftOraBlob:
StringGrid1.Cells[j,i+1]:='
BLOB fields in Oracle 8 tables';
ftOraClob:
StringGrid1.Cells[j,i+1]:='
CLOB fields in Oracle 8 tables';
ftVariant:
StringGrid1.Cells[j,i+1]:='
Data of unknown or undetermined type';
ftInterface:
StringGrid1.Cells[j,i+1]:='
References to interfaces (IUnknown)';
ftIDispatch:
StringGrid1.Cells[j,i+1]:='
References to IDispatch interfaces';
ftGuid:
StringGrid1.Cells[j,i+1]:='
globally unique identifier (GUID) values';
ftTimeStamp:
StringGrid1.Cells[j,i+1]:='
Timestamp field';
ftFMTBcd:
StringGrid1.Cells[j,i+1]:='
FMTBcd field';
else
StringGrid1.Cells[j,i+1]:='
Irgendwas anderes';
end;
end;
Label2.Caption := IntToStr(ZQuery1.RecNo);
ZQuery1.Next;
end;
// DB-Verbindung beenden
ZConnection1.Disconnect;