Readme_Custom Report Item Sample

[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

This sample works only with SQL Server 2005 and SQL Server 2008. It will not work with any version of SQL Server earlier than SQL Server 2005.

PolygonsCRI is a simple custom report item sample. This sample uses the System.Component classes from the Microsoft .NET Framework and classes from the Microsoft.ReportDesigner and Microsoft.ReportingServices namespaces to implement a custom report item run-time component and design-time component that can be used in Report Designer.

ms345265.note(en-us,SQL.105).gifImportant:
Samples are provided for educational purposes only. They are not intended to be used in a production environment and have not been tested in a production environment. Microsoft does not provide technical support for these samples. Sample applications and assemblies should not be connected to or used with your production SQL Server database or your report server without the permission of the system administrator.

You should be familiar with Visual Studio and Microsoft Visual C#, and your system must meet the following requirements to use the PolygonsCRI sample:

  • Microsoft SQL Server with Reporting Services.
  • Microsoft SQL Server Business Intelligence Development Studio.
  • Microsoft Visual Studio 2008.
  • Microsoft .NET Framework 2.0.
  • Reporting Services samples.
  • A report server that you have permission to access on your network.
    ms345265.note(en-us,SQL.105).gifNote:
    Business Intelligence Development Studio is not supported on Itanium-based computers. However, support is available for x64-based computers. If the SQL Server sample databases have been deployed on an Itanium-based computer, use BI Development Studio on either an x86-based or x64-based computer to modify and run the samples.

ms345265.note(en-us,SQL.105).gifImportant:
SQL Server samples and sample databases must be downloaded and installed before you can view or work with them. For more information, see Considerations for Installing SQL Server Samples and Sample Databases.

By default, this sample is located in the following directory:

C:\Program Files\Microsoft SQL Server\100\Samples\Reporting Services\Extension Samples\PolygonsCustomReportItem Sample

If you have not already created a strong name key file, generate the key file using the following instructions.

  1. Open a Microsoft Visual Studio 2005 command prompt. Click Start, point to All Programs, point to Microsoft .NET Framework SDK 2.0, and then click SDK Command Prompt.

    -- or --

    Open a Microsoft .NET Framework command prompt. Click Start, point to All Programs, point to Microsoft .NET Framework SDK 2.0, and then click SDK Command Prompt.

  2. Use the change directory command (CD) to change the current directory of the command prompt window to the folder where the samples are installed.
    ms345265.note(en-us,SQL.105).gifNote:
    To determine the folder where samples are located, click the Start button, point to All Programs, point to Microsoft SQL Server, point to Documentation and Tutorials, and then click Samples Directory. If the default installation location was used, the samples are located in <system_drive>:\Program Files\Microsoft SQL Server\100\Samples.
  3. At the command prompt, run the following command to generate the key file:

    sn -k SampleKey.snk

    ms345265.note(en-us,SQL.105).gifImportant:
    For more information about the strong-name key pair, see "Security Briefs: Strong Names and Security in the .NET Framework" in the .NET Development Center on MSDN.

  1. Open a Microsoft Visual Studio 2005 command prompt. Click Start, point to All Programs, point to Microsoft Visual Studio 2008, then point to Visual Studio Tools, and then click Visual Studio 2008 Command Prompt.

  2. Use the change directory command (CD) to change the current directory of the Command Prompt window to the folder where the samples are installed.

  3. At the command prompt, run the following command to generate the key file:

    sn -k SampleKey.snk
    
    ms345265.note(en-us,SQL.105).gifNote:
    For more information about the strong-name key pair, see Security Briefs: Strong Names and Security in the .NET Framework in the .NET Development Center on MSDN.

  1. Open the CS\PolygonsCRI.sln project file into Visual Studio 2008.

  2. From the Build menu, select Build Solution.

  1. Edit the rsreportserver.config file (by default located in the directory %PROGRAMFILES%\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\ReportServer) to register the PolygonsCRI:

    • Insert the following lines before the </Extensions> line:
      <ReportItems>
         <ReportItem Name="Polygons" Type="Microsoft.Samples.ReportingServices.PolygonsCustomReportItem,PolygonsCRI"/>
      </ReportItems>
      
  2. Edit the rssrvpolicy.config file (by default located in the directory %PROGRAMFILES%\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\ReportServer) to add a code group for the custom report item:

    • Add the following lines and change the PROGRAMFILES string to the %PROGRAMFILES% directory:
      <CodeGroup 
         class="UnionCodeGroup" 
         version="1" 
         PermissionSetName="FullTrust"
         Description="This code group grants PolygonsCRI.dll FullTrust permission. ">
         <IMembershipCondition 
         class="UrlMembershipCondition"
         version="1"
         Url="C:\Program Files\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\ReportServer\bin\PolygonsCRI.dll" />
      </CodeGroup>
      
  3. Edit the rsreportdesigner.config file (by default located in the directory %PROGRAMFILES%\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies) to register the run-time component, the design-time component, and the item type converter:

    • Add the following lines before the </Extensions> line:
      <ReportItems>
         <ReportItem Name="Polygons" Type="Microsoft.Samples.ReportingServices.PolygonsCustomReportItem,PolygonsCRI"/>
      </ReportItems>
      <ReportItemDesigner>
         <ReportItem Name="Polygons" Type=" Microsoft.Samples.ReportingServices.PolygonsDesigner, PolygonsDesigner" />
      </ReportItemDesigner>
      
  4. Copy the PolygonsCRI.dll file from the CS\PolygonsCRI\Bin\Debug directory where you copied the sample project to the Visual Studio private assemblies directory (by default, %PROGRAMFILES%\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies).

  5. Copy the PolygonsCRI.dll file from the CS\PolygonsCRI\Bin\Debug directory where you copied the sample project to the Microsoft SQL Server Reporting Services bin directory (by default, %PROGRAMFILES%\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\ReportServer\Bin).

  6. Copy the PolygonsDesigner.dll file from the CS\PolygonDesigner\Bin\Debug directory to the Visual Studio private assemblies directory (by default, %PROGRAMFILES%\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies).

This section contains a quick walkthrough that shows how to reference the Polygon custom report item in Visual Studio and then test it.

  1. Right-click the Visual Studio Toolbox.

  2. Select Choose items.

  3. Navigate to the %PROGRAMFILES%\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies folder and select PolygonsDesigner.dll.

  1. Open the \PolygonsReport\Polygons.sln sample report project in Visual Studio.

  2. Click the Preview tab in the sample report, or deploy the sample report to the server and run the sample report.

  1. Restart the Reporting Services service by running the following commands at the command prompt:

    net stop "SQL Server Reporting Services (Instance_Name)
    net start "SQL Server Reporting Services (Instance_Name)
    
  2. With the Polygons.sln solution opened, in the Solution Explorer, right-click the Polygons project, and click Deploy.

  3. In the brower, access the report server URL and click the Polygons report to view it.

To edit a report using the PolygonDesigner custom control in Visual Studio, you can do any of the following:

  • Set the properties of the polygons control in the property browser.
  • Edit properties through the control's shortcut menu.
  • Drag fields onto the drop areas of the control from the fields list.

Community Additions

Show: