Recent

Author Topic: [SOLVED] Tdbf : how to know the fields type  (Read 4011 times)

arwen

  • Full Member
  • ***
  • Posts: 104
    • http://www.flussiliberi.it/
[SOLVED] Tdbf : how to know the fields type
« on: July 10, 2007, 12:02:05 pm »
When with a Tdbf object I open a table how I can know
the type of a field knowing it's name ?

In other words :
I open table X and I know that it contains a field Z as I can
know that type of field is Z (integer, date...)?

Thanks to all !!

arwen

  • Full Member
  • ***
  • Posts: 104
    • http://www.flussiliberi.it/
SOLVED
« Reply #1 on: July 10, 2007, 02:18:15 pm »
That's the solution :

Code: [Select]

if DBf1.Fields.FieldByName(FiledName).DataType = ftDate then
  begin
       // do something if the field is a date type

  end;


The other type is all the ft.. type valid for the table level
Quote

    ftUnknown, ftString, ftSmallint, ftInteger, ftWord,
    ftBoolean, ftFloat, ftCurrency, ftBCD, ftDate,  ftTime, ftDateTime,
    ftBytes, ftVarBytes, ftAutoInc, ftBlob, ftMemo, ftGraphic, ftFmtMemo,
    ftParadoxOle, ftDBaseOle, ftTypedBinary, ftCursor, ftFixedChar,
    ftWideString, ftLargeint, ftADT, ftArray, ftReference,
    ftDataSet, ftOraBlob, ftOraClob, ftVariant, ftInterface,
    ftIDispatch, ftGuid, ftTimeStamp, ftFMTBcd


In this mode I can know at run time the field type .

 :idea:

 

TinyPortal © 2005-2018