Question
“How can I programmatically register my report server with ReportBuilder Services?”
Solution
RB Server Edition includes a windows service called ReportBuilder Services. ReportBuilder Services can host your report server. For details see RBServer\Windows Services\ReadMe.doc.
This example shows how to programmatically register a report server with ReportBuilder Services.
Download: RegisterReportServer.zip
Sample Delphi code:
uses
rsWinServiceController;
{------------------------------------------------------------------------------}
{ TForm1.FormCreate }
procedure TForm1.FormCreate(Sender: TObject);
begin
// initialize - display name the existing server
UpdateServerName;
end;
{------------------------------------------------------------------------------}
{ TForm1.Button1Click }
procedure TForm1.Button1Click(Sender: TObject);
var
lsServerExe: String;
begin
// get the currently registered report server
lsServerExe := TrsWinServiceController.GetCOMServerExeName;
// file browse for server .exe and then register the server
if TrsWinServiceController.BrowseForCOMServerExe(lsServerExe) then
begin
Screen.Cursor := crHourGlass;
try
TrsWinServiceController.RegisterCOMServer(lsServerExe);
finally
Screen.Cursor := crDefault;
end;
if (TrsWinServiceController.GetCOMServerExeName = lsServerExe) then
UpdateServerName
else
MessageDlg('Unable to register application as a COM server: ' + lsServerExe, mtWarning, [mbOK], 0)
end;
end;
{------------------------------------------------------------------------------}
{ TForm1.UpdateServerName }
procedure TForm1.UpdateServerName;
var
lsServerExe: String;
begin
// get the currently registered report server
lsServerExe := TrsWinServiceController.GetCOMServerExeName;
// update the form to display the name and path of the server
lblServerExe.Caption := ExtractFileName(lsServerExe);
lblServerPath.Caption := ExtractFilePath(lsServerExe);
end;