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:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
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; |