Adding Custom Code to the Reporting Services 2008 R2

Compile the code to generate the TestClass.dll file. To access the code inside this file we need to place this dll  in the default location of the Report Designer which is  \Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies.

To add a reference to the file inside the report perform the following steps:

1. Select Report-> Report Properties from the menu.

2. Select the Reference  tab from the report property window

3. Add a reference to the TestClass.dll by browsing to the location of the default report designer i.e \Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies

4. Add the following code in the expression of the textbox of the tablix.

=TestClass.Class1.Cal(3,4)
This code calls the function defined in the assembly reference. Here you don’t need to use the Code keyword to access the function defined in the Custom assembly. You can also define an instance of the class used in the custom assembly but this is optional as you can access the function using the namespace.classname.functioname inside the expression as shown below:-

5. The output should be as follows

For the custom code to be working after deploying the report you will need to paste the testClass.dll  – i.e the dll file in the bin folder of the reporting services whose default location is

\Program Files\Microsoft SQL Server\Instance_Name\Reporting Services\ReportServer\bin

Finally, just click right on the solution and deploy it on the report server to view it in the production environment.

Pages: 1 2




Array

No comments yet... Be the first to leave a reply!