RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TNamedItem.Name Property

Specifies the name of the database entity defined by the TNamedItem object.

Pascal
property Name: WideString;
C++
__property BSTR Name;

Use Name to specify the name that the underlying database table uses to refer to the defined object. For example, if the TNamedItem object is a field definition, the value of Name is the name of the corresponding field in the underlying database table.

Note: For dBASE maintained indexes, Name refers to the tag name of the index. For Paradox tables, the Name of the primary key is an empty string.
 

C++ Examples: 

 

/*
This example uses the IndexName property to sort the records
in a client dataset on the Field2 field.
*/
void __fastcall TForm1::Button3Click(TObject *Sender)
{
  // If Active is True, Update will remove Fields added in FormCreate
  // and add the DEFAULT_ORDER and CHANGEINDEX Fields
  CDS2->Active = False;
  // Get the current available indices
  CDS2->IndexDefs->Update();
  // Find a field named "Field2"
  for (int I = 0; I < CDS2->IndexDefs->Count; I++)
    if (CDS2->IndexDefs->Items[I]->Fields == "Field2")
    {
      // set that index as the current index for the dataset}
      CDS2->IndexName = CDS2->IndexDefs->Items[I]->Name;
    }
  CDS2->Active = True;
}

 

Delphi Examples: 

{
This example uses the IndexName property to sort the records
in a client dataset on the Field2 field.
}
procedure TForm1.Button3Click(Sender: TObject);
var
  I : Integer;
begin
  // If Active is True, Update will remove Fields added in FormCreate
  // and add the DEFAULT_ORDER and CHANGEINDEX Fields
  CDS2.Active := False;
  { Get the current available indices }
  CDS2.IndexDefs.Update;
  { Find a field named 'Field2' }
  for I := 0 to CDS2.IndexDefs.Count - 1 do
    if CDS2.IndexDefs.Items[I].Fields = 'Field2' then
    begin
      { set that index as the current index for the dataset}
      CDS2.IndexName := CDS2.IndexDefs.Items[I].Name;
    end;
  CDS2.Active := True;
end;

 

DisplayName 

Source 

IndexName

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!