AutoCAD 3DMAX C语言 Pro/E UG JAVA编程 PHP编程 Maya动画 Matlab应用 Android
Photoshop Word Excel flash VB编程 VC编程 Coreldraw SolidWorks A Designer Unity3D
 首页 > Delphi

Delphi开发工具中如何访问数据库结构

51自学网 http://www.51zixue.net

 

  4 获取数据域和索引信息

  在取得了数据表信息后,应使用TTable对象访问该数据表的具体信息。对应函数如下:

以下是引用片段:
  procedure TDataSet.GetFieldNames(List: TStrings);
  procedure TTable.GetIndexNames(List: TStrings);

  GetFieldNames用来取得数据表中的各个域名,GetIndexNames用来取得数据表中的各个索引名。

  另外,可以进一步使用TDataset和TTable中的两个属性TDataSet.FieldDefs.Items[] 和 TTable.IndexDefs.Items[]来访问具体的数据域信息和索引信息。它们分别是由TFieldDef和TIndexDef组成的数组。

  TFieldDef描述如下:

点击放大此图片

  TIndexDef描述如下:

点击放大此图片

  TFieldType定义如下:

以下是引用片段:
  TFieldType = (ftUnknown, ftString, ftSmallint, ftInteger, ftWord, ftBoolean,
  ftFloat,ftCurrency, ftBCD, ftDate, ftTime, ftDateTime, ftBytes, ftVarBytes,
  ftAutoInc,ftBlob, ftMemo, ftGraphic, ftFmtMemo, ftParadoxOle, ftDBaseOle,
  ftTypedBinary,ftCursor);

  TIndexOptions定义如下:

以下是引用片段:
TIndexOptions = set of (ixPrimary, ixUnique, ixDescending, ixExpression, ixCaseInsensitive);

  它们的具体意义可以参见Delphi帮助。

 
 

上一篇:经验技巧:分享两条Delphi开发经验  下一篇:elphi情结——永不消逝的精灵