2014-03-27 2 views
1

아래의 코드 조각에서 TQuery에는 세션 객체를 사용하여 DatabaseName이 할당됩니다. fireDAC에서 우리가 어떻게 따라 할 수 있을지 또는 비슷한지 제안 할 수 있습니까?BDE와 같은 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; 

faidac에는 TFDManager, TFDConnection, TFDQuery Object가 있습니다. 내가 알고 싶은 건, 서로 다른 .pas 파일의 여러 TFDQuery가 얼마나 유사한 연결에 액세스 할 수 있는지입니다. fireDAC에서 어떻게 관리합니까?

+0

SessionName은 FireDAC에 없습니다. DatabaseName이있는 줄은 다음과 같이 바꿔야합니다. ConnectionName : = FDManager.Connections [0] .ConnectionName; –

+0

@ da-soft 감사합니다. – user3406438

답변

1

나는 이것을 FireDAC TFDManager 객체를 사용하여 해결했다.

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

을 그리고 그것은 작동 : 프로젝트 파일의 맞은 편에

내가 사용하고 있습니다.