So eine Funktion hatte ich mir mal dazu gebaut.
Vielleicht hilft es ja wenn du es dir mal ansiehst.
Sie löst gleich beide Probleme auf einmal.
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43:
| function FieldtypeToString(Fld: TField; ShowSize: Boolean): String; begin Case Fld.DataType of ftString : Result := 'CHAR'; ftSmallint : Result := 'SMALLINT'; ftInteger : Result := 'INTEGER'; ftWord : Result := 'WORD'; ftBoolean : Result := 'BOOLEAN'; ftFloat : Result := 'FLOAT'; ftCurrency : Result := 'CURRENCY'; ftBCD : Result := 'BCD'; ftDate : Result := 'DATE'; ftTime : Result := 'TIME'; ftDateTime : Result := 'DATETIME'; ftBytes : Result := 'BYTES'; ftVarBytes : Result := 'VARBYTES'; ftAutoInc : Result := 'AUTOINC'; ftBlob : Result := 'BLOB'; ftMemo : Result := 'MEMO'; ftGraphic : Result := 'GRAPHIC'; ftFmtMemo : Result := 'FORMATTED MEMO'; ftParadoxOle : Result := 'PARADOX OLE'; ftDBaseOle : Result := 'DBASE OLE'; ftTypedBinary : Result := 'TYPED BINARY'; ftCursor : Result := 'CURSOR (ORACLE)'; ftFixedChar : Result := 'FIXED CHAR'; ftWideString : Result := 'WIDE STRING'; ftLargeInt : Result := 'LARGEINT'; ftADT : Result := 'ABSTRACT DATA TYPE'; ftArray : Result := 'ARRAY'; ftReference : Result := 'REFERENCE'; ftDataSet : Result := 'DATA SET'; ftOraBlob : Result := 'ORACLE 8 - BLOB'; ftOraClob : Result := 'ORACLE 8 - CLOB'; ftVariant : Result := 'VARIANT'; ftInterface : Result := 'INTERFACE'; ftIDispatch : Result := 'DISPATCH - REFERENCE'; ftGuid : Result := 'GUID'; else Result := 'UNKNOWN DATA TYPE'; end; If ShowSize and (Fld.Size > 0) then Result := Result + ' (' + IntToStr(Fld.Size) + ')'; end; |
Ich habe hier die von Delphi vordefinierten Bezeichner verwendet. Diese hättest du eigentlich in der Hilfe unter
TFieldType finden müssen.
An die Grösse kommt man, wie du siehst, über die Eigenschaft
Size von
TField.
Hoffe, dir damit geholfen zu haben.