您的位置:首页 > 其它

Custom Report Item Sample

2009-12-08 11:12 197 查看

Readme_Custom Report Item Sample

11/10/2009 10:36:06
哎!这个还是给程序员使用的并不是用户自定Report Item

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.

Important:
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.

Requirements

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.

Note:
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.
Important:
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.

Location

By default, this sample is located in the following directory:
C:/Program Files/Microsoft SQL Server/100/Samples/Reporting Services/Extension Samples/PolygonCustomReportItem Sample

Building the Sample

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

To generate a strong name key file

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.

Use the change directory command (CD) to change the current directory of the command prompt window to the folder where the samples are installed. Note: 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.*

At the command prompt, run the following command to generate the key file: sn -k SampleKey.snk Important: 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.

To build the PolygonsCRI sample

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

From the Build menu, select Build Solution.

Deploying the Sample

To deploy the PolygonsCRI sample

Edit the rsreportserver.config file (by default located in the directory %ProgramFiles%/Microsoft SQL Server/MSRS10.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>


Edit the rssrvpolicy.config file (by default located in the directory %ProgramFiles%/Microsoft SQL Server/MSRS10.MSSQLSERVER/Reporting Services/ReportServer) to add a code group for the custom report item:

Add the following lines and change the PROGRAMFILES string to your Program Files directory:

<CodeGroup
class="UnionCodeGroup"
version="1"
PermissionSetName="FullTrust"
Description="This code group grants PolygonsCRI.dll FullTrust permission. ">
<IMembershipCondition
class="UrlMembershipCondition"
version="1"
Url="PROGRAMFILES/Microsoft SQL Server/MSRS10.MSSQLSERVER/Reporting Services/ReportServer/bin/PolygonsCRI.dll" />
</CodeGroup>


Edit the rsreportdesigner.config file (by default located in the directory C:/Program Files/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>


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).

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.MSSQLSERVER/Reporting Services/ReportServer/Bin).

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).

Running the Sample

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

To add PolygonDesigner to the Visual Studio Toolbox

Right-click the Visual Studio Toolbox.

Select Choose items.

Navigate to the %ProgramFiles%/Microsoft Visual Studio 9.0/Common7/IDE/PrivateAssemblies folder and select PolygonsDesigner.dll.

To publish and view the sample on the report server

Restart the Reporting Services service by running the following commands at the command prompt:
net stop "SQL Server Reporting Services InstanceName"

net start "SQL Server Reporting Services InstanceName"

With the Polygons.sln solution opened, in the Solution Explorer, right-click the Polygons project, and click Deploy.

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.

See Also

Tasks
Compiling and Running Code Examples Reporting Services Samples

Other Resources
Custom Report Item Implementation Requirements Extension Samples (Reporting Services)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: