<< Click to Display Table of Contents >> Navigation: Apollo VCL Components > Apollo VCL Component Reference > TApolloQuery > TApolloQuery Properties > AccessMethod |
Declaration
property AccessMethod: TAccessMethod;
TAccessMethod = (amLocal, amServer);
The TAccessMethod type is defined in the ApCommon unit. Therefore, this unit must be included in the uses line of any unit containing code that makes direct references to a TAccessMethod value.
Description
Indicates if the query is to be executed locally (amLocal) using the Apollo SQL add-in or remotely through an Apollo Database Server (amServer). When set to amLocal, the DatabaseName property is used to identify the local path or alias where the tables in the SQL statement are located. When set to amServer, the DatabaseName property identifies the database alias on the remote Apollo Database Server that the ApolloConnection property is connected to.
The default AccessMethod setting for TApolloQuery is amServer.
The TApolloConnection component's Host, Port, and Active properties are not used when connecting to local data via Apollo SQL with TApolloQuery (with AccessMethod set to amLocal).
Delphi Example
// If CheckBox is Checked, open local copy of files
if cbIsLocal.Checked then
begin
// Close remote connection, if active
ApolloConnection1.Active := False;
// Use Apollo SQL add-in
ApolloQuery1.AccessMethod := amLocal;
ApolloQuery1.Open;
end
else
begin
// Use Apollo Database Server
ApolloQuery1.AccessMethod := amServer;
ApolloConnection1.Host := 'www.yourserver.com';
ApolloConnection1.Port := 8121;
// Open remote connection
ApolloConnection1.Active := True;
ApolloQuery1.Open;
end;
C++Builder Example
// If CheckBox is Checked, open local copy of files
if (cbIsLocal->Checked)
{
// Close remote connection, if active
ApolloConnection1->Active = False;
// Use Apollo SQL add-in
ApolloQuery1->AccessMethod = amLocal;
ApolloQuery1->Open();
}
else
{
// Use Apollo Database Server
ApolloQuery1->AccessMethod = amServer;
ApolloConnection1->Host = "www.yourserver.com";
ApolloConnection1->Port = 8121;
// Open remote connection
ApolloConnection1->Active = True;
ApolloQuery1->Open();
}
See Also
ApolloConnectionTApolloQuery_ApolloConnection, TApolloConnectionTApolloConnection