RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TDBDataSet.DatabaseName Property

Specifies the name of the database associated with this dataset.

Pascal
property DatabaseName: string;
C++
__property AnsiString DatabaseName;

Use DatabaseName to specify the name of the database to associate with this dataset component. DatabaseName should match the name of a database component used in the application.

Note: Attempting to set DatabaseName when a database already associated with this component is open raises an exception.
Tip: At design time double-click a TDatabase component to invoke the Database editor and set the DatabaseName.
 

Delphi Examples: 

 

{
This example requires a database with the following name or
in the form of a *.DB file in the following path.  The table
should be closed when changing the database.
}
procedure TForm1.Button1Click(Sender: TObject);
begin
  Customers.Active := False;
  try
  { First try to use an alias }
    Customers.DatabaseName := 'DBDEMOS';
    Customers.Active := True;
  except
    on EDatabaseError do
    begin
      { If that fails, try to use the drive and directory }
      Customers.TableName := 'Flights';
      Customers.DatabaseName :=
        'c:\Documents and Settings\All Users\Documents\RAD Studio\5.0\Demos\IntraWeb\Win32\FlightInformation\Data';
      Customers.Active := True;
    end;
  end;
end;

 

Database 

DBHandle 

Using Implicit Connections 

Creating and Deleting Tables 

Using Query-type Datasets 

Using Stored Procedure-type Datasets 

Using Table Type Datasets 

Associating a Dataset with Database and Session Connections 

Using Multiple Update Objects 

Connecting Directly to a Database Server

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