ClientDataset摘录

Field,Fields,FieldDef,FieldDefs,FieldDefList区别

http://www.cnblogs.com/del/archive/2010/01/27/1657349.html


1
Fields Field 的集合, 它们主要用于运行时对字段元数据和字段值的访问.

2
FieldDefs FieldDef 的集合, 它们主要用于构建数据集()和对字段元数据的访问.

3
FieldList FieldDefList 分别是访问 Field FieldDef 的快捷列表; 主要使用其 FieldByNameFind 方法和默认的数组属性访问数据; 它们是只读的.

4
、通过 FieldsFieldListField 可以得到更多信息, 但必须是在数据集打开的情况下;
通过 FieldDefsFieldDefListFieldDef 只能获取定义时的信息, 但即使在数据集关闭时也能使用.

5
、顾名思义 FieldDef 是用于定义表的, 但通过 Field 也可以定义表;
FieldDef 定义表很方便, Field 可以定义一些更复杂的表;
每个 FieldDef 都会对应一个 Field, 但一个 Field 不一定有 FieldDef 对应;
程序运行后 FieldDef 不能再改变, Field Fields 则可以动态改变或增减.

ClientDataset排序

http://www.cnblogs.com/del/archive/2010/01/28/1658118.html

AddIndex(
  const Name: string;          { 索引名称; 不能重名 }
  const Fields: string;        { 索引字段; 多个字段用分号隔开; 默认升序排列 }
  Options: TIndexOptions;      { 选项 }
  const DescFields,            { 按降序排列的字段; 须先在 Fields 中列出 }
  const CaseInsFields: string; { 不区分大小写的字段; 须先在 Fields 中列出 }
  const GroupingLevel: Integer { 分组级别, 用于分组统计的 }
);

 

//Options:
IxPrimary         { 主索引 }
IxUnique          { 字段值无重复 }
ixDescending      { 降序 }
ixCaseInsensitive { 不区分大小写 }
ixExpression      { 无用 }
ixNonMaintained   { 无用 }

 

//F1F2 降序, 两种写法一样:

AddIndex('Index_1', 'F1; F2', [ixDescending]);

AddIndex('Index_2', 'F1; F2', [], 'F1; F2');

 

//F1F2 不区分大小写排序(不指定降序则默认升序):

AddIndex('Index_1', 'F1; F2', [ixCaseInsensitive]);

AddIndex('Index_2', 'F1; F2', [], '', 'F1; F2');

 

//F1 升序, F2 降序:

AddIndex('Index_1', 'F1; F2', [], 'F2');

AddIndex('Index_2', 'F1; F2', [ixDescending], 'F2'); { 此时 [ixDescending] 被忽略 }

 

//F1 降序, F2 升序:

AddIndex('Index_1', 'F1; F2', [], 'F1');

AddIndex('Index_2', 'F1; F2', [ixDescending], 'F1');

posted @ 2017-12-05 06:03  后凤凰  阅读(110)  评论(0)    收藏  举报