我写了代码,索引好像不对,请问怎么建索引,怎么用呢?
with table1 do begin
active:=false;
databasename:=ExtractFilePath(Application.ExeName)+'data';
tabletype:=ttfoxpro;
tablename:='BM'+iniinfo.CityID+iniinfo.CountryID+'.dbf';
if not table1.Exists then begin
table1.FieldDefs.Add('school',ftstring,2,false);
table1.FieldDefs.Add('name',ftstring,10,false);
table1.FieldDefs.Add('id',ftstring,9,false);
table1.FieldDefs.Add('date',ftstring,5,false);
with IndexDefs do begin
Clear;
with AddIndexDef do begin
Name := 'Index_id';
Fields := 'id';
Options :=[ixPrimary];
end;
end;
CreateTable;
with table1 do begin
active:=false;
databasename:=ExtractFilePath(Application.ExeName)+'data';
tabletype:=ttfoxpro;
tablename:='BM'+iniinfo.CityID+iniinfo.CountryID+'.dbf';
if not table1.Exists then begin
table1.FieldDefs.Add('school',ftstring,2,false);
table1.FieldDefs.Add('name',ftstring,10,false);
table1.FieldDefs.Add('id',ftstring,9,false);
table1.FieldDefs.Add('date',ftstring,5,false);
with IndexDefs do begin
Clear;
with AddIndexDef do begin
Name := 'Index_id';
Fields := 'id';
Options :=[ixPrimary];
end;
end;
CreateTable;
你认为呢。
无奈