索引(50分)

  • 主题发起人 主题发起人 chenlihua
  • 开始时间 开始时间
C

chenlihua

Unregistered / Unconfirmed
GUEST, unregistred user!
我用DELPHI4开发程序用的是DBASEⅣ数据库,请问在DBASE中如何建立包含2个
以上字段的复合索引?
 
用CASE工具吧。
 
呵呵,用CASE工具好象有点高射炮打文字吧?ERWIN?
直接用DBD好了,记得里面有个单选筐(按钮?)具体自己试一下,呵呵,瞎灌
 
用database desktop只能建立单个字段的索引,
可能用单独的DBASEⅣ数据库才可以建他的复合索引。
为什么要复合索引?
 
一定可以的!//CJ胆怯地说
 
Creating dBASE Expression Indexes In Delphi Applications
========================================================

dBASE indexes can be created programmatically in Delphi
applications,either as a new table is being created (CreateTable
method of the TTable component) or by adding an index to an existing
table.
Creating an index as part of a new table being created is a
matter of calling the Add method for the IndexDefs property of the
TTable. A special consideration that the index options must include
the option ixExpression. This index option is unique to dBASE ndexes,
and should only be used with dBASE expression indexes. For example:

with Table1 do begin
Active := False;
DatabaseName := 'Delphi_Demos';
TableName := 'CustInfo';
TableType := ttdBASE;
with FieldDefs do begin
Clear;
Add('LastName', ftString, 30, False);
Add('FirstName', ftString, 20, False);
end;
with IndexDefs do begin
Clear;
Add('FullName', 'LastName + FirstName', [ixExpression]);
end;
CreateTable;
end;

Adding an index to an existing table is accomplished by calling
the Add-Index method of the TTable. Again, the index options must
include the TIndexOptions value ixExpression.

Table1.AddIndex('FullName', 'LastName + FirstName', [ixExpression]);

 
[ixExpression]索引表达式: 需要你使用DBASE表达式语法。

用DBD建立表达式索引也是可以的:
Click "Expression Index" Button
and enter LASTNAME+FIRSTNAME in "Expression Index"
and enter your [ixExpression] in "Subset condition(filter) expression
 
多人接受答案了。
 
后退
顶部