EnterpriseDBDAC

Example: IndexDefs, Update, Count, Items, IndexName, Fields, Name

 Previous Next

This example uses the IndexName property to sort the records in a table on the CustNo and OrderNo fields.

EDBTable1.Active := False;
// Get the current available indexes
EDBTable1.IndexDefs.Update;
// Find one which combines Customer Number ('CustNo')
// and Order Number ('OrderNo')
for I := 0 to EDBTable1.IndexDefs.Count - 1 do
  if EDBTable1.IndexDefs.Items[I].Fields = 'CustNo;OrderNo' then
// Set that index as the current index for the table
    EDBTable1.IndexName := EDBTable1.IndexDefs.Items[I].Name;
    EDBTable1.Active := True;