table1.Fields[0].DataType; 不是字符型的,怎么办?

解决方案 »

  1.   

    如果你用的是SQL Server,用sp_Columns
      

  2.   

    用TDateset.FieldDefs.Items[n].DataType
      

  3.   

    label1.Caption:=table1.FieldDefs.Items[1].DataType;
    提示错误
    [Error] Unit1.pas(31): Incompatible types: 'String' and 'TFieldType'
    怎么办?
      

  4.   

    用oracle的话,可以用select DATA_TYPE from user_tab_columns where table_name=
    表名 and column_name=列名 来得到类型
      

  5.   

      case table1.Fielddefs.Items[i].DataType of
      ftUnknown:caption:='ftUnknown';
      ftString:caption:='ftString';
      ftSmallint:caption:='ftSmallint';
      ftInteger:caption:='ftInteger';
      ftWord:caption:='ftWord';
     ......
      end;