unit ReportConnection; interface uses ADODB, ProjectData, ReportManager, rpgGatherControl; type TReportConnection = class private FProjectData: TProjectData; FConnection: TADOConnection; FCommonGather: TrpgGatherControl; public constructor Create(AProjectData: TProjectData); destructor Destroy; override; procedure RefreshConnection(ATemplate: TTemplateNode); property Connection: TADOConnection read FConnection; end; implementation { TReportConnection } constructor TReportConnection.Create(AProjectData: TProjectData); begin FProjectData := AProjectData; FCommonGather := TrpgGatherControl.Create(AProjectData.ProjectID); end; destructor TReportConnection.Destroy; begin FCommonGather.Free; inherited; end; procedure TReportConnection.RefreshConnection(ATemplate: TTemplateNode); begin case ATemplate.DataBaseFlag of 0: FConnection := FProjectData.ADOConnection; 1: FConnection := FCommonGather.RefreshConnection; end; end; end.