We help IT Professionals succeed at work.

how to add an index to an existing TTable

jupe
jupe asked
on
I would like to add an additional index to an existing Table. I have no problem doing this with dbd32.exe.

Can you give mit a code snippet showing how to do it in a program (Delphi 4)?

Thanks in advance
Jupe
Comment
Watch Question

Mohammed NasmanSoftware Developer
CERTIFIED EXPERT

Commented:
you can do that using AddIndex

Table1.AddIndex('NewIndex', 'CustNo;CustName', [ixUnique, ixCaseInsensitive]);

refer to delphi help for more info
Software Developer
CERTIFIED EXPERT
Commented:
Hello

   here's a sample, it will add new index for the table customer from dbdeoms


procedure TForm1.Button1Click(Sender: TObject);
begin
  Table1.Close;
  Table1.Exclusive := TRUE;
  Table1.AddIndex('NewIndex', 'CustNo;Company', []);
  Table1.IndexDefs.Update;
  Table1.Exclusive := FALSE;
  Table1.Open;
end;

Best regards
Mohammed Nasman

Author

Commented:
Thanks mnasman
jupe
Mohammed NasmanSoftware Developer
CERTIFIED EXPERT

Commented:
You are welcome any time :o)

Explore More ContentExplore courses, solutions, and other research materials related to this topic.