unit ReportConnection; interface uses ADODB, ProjectData, ReportManager, rpgGatherControl, rpgZoneGatherControl; type TReportConnection = class private FProjectData: TProjectData; FConnection: TADOConnection; FCommonGather: TrpgGatherControl; FZoneGather: TrpgZoneGatherControl; 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); FZoneGather := TrpgZoneGatherControl.Create(AProjectData); FConnection := AProjectData.ADOConnection; end; destructor TReportConnection.Destroy; begin FCommonGather.Free; FZoneGather.Free; inherited; end; procedure TReportConnection.RefreshConnection(ATemplate: TTemplateNode); begin case ATemplate.DataBaseFlag of 0: FConnection := FProjectData.ADOConnection; 1: FConnection := FCommonGather.RefreshConnection(ATemplate); 2: FConnection := FZoneGather.RefreshConnection(ATemplate); end; end; end.