Domanda

In the below code snippet the TQuery is assigned a DatabaseName using Sessions Object. Can you please suggest how can we do following or similiar in fireDAC?

TmpQuery := TQuery.Create(nil);
try
  with TmpQuery do
  begin
    SessionName := Sessions.CurrentSession.SessionName;
    DatabaseName := Sessions.CurrentSession.Databases[0].DatabaseName;
    SQL.Add('select tendr_type, tendr_code');
    SQL.Add('from asatendr where tendr_status="A" ');
    Open;
    while not EOF do
    begin // do the name value pair so i can find them...
      FaTenderList.Add(Trim(Fields[0].AsString) + '=' + Trim(Fields[1].AsString));
      Next;
    end;
    Close;

In firedac we have TFDManager, TFDConnection, TFDQuery Object. All I wanna know is how similiar connection can be accessed by multiple TFDQueries in diffrent .pas files. How this is managed in fireDAC?

È stato utile?

Soluzione

I have resolved this using FireDAC TFDManager object.

Across the project files I am using:

ConnectionName := FDManager.Connections[0].ConnectionName; 

And it works.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top