2011-11-30 65 views
1

好的,我有很多RDLC的麻烦,所以回到RDL报告。现在,我明白我需要报告服务器才能运行报告,然后在前端可以使用报告查看器并选择报告路径。我正在使用本地计算机,因此至少要使其在本地工作。我不明白如何在本地安装报告服务器。我在网上发现了一些MSDN文章,但它们过于复杂。有关于如何使用网页中的RDL报告的简单教程?如何在网站上显示rdl报告

回答

0

我假设你熟悉asp.net。创建一个新的asp.net应用程序或网站。 添加Microsoft.Reporting.WebForms的参考(右键 - >添加引用)

然后在你的页面指令添加这个

<%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" 
Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %> 

那么你应该能够使用ReportViewer控件作为

<rsweb:ReportViewer ID="rptOne" runat="server" AsyncRendering="true" ProcessingMode="Remote" ShowPrintButton="false" ShowPageNavigationControls="true" ShowParameterPrompts="false" ShowBackButton="true" ShowExportControls="true" Height="1000px" Width="1000px" SizeToReportContent="false"> </rsweb:ReportViewer>

(当然,你不需要设置我做的所有属性。)

你ç一个然后设置您的网址后面的代码

 Me.rptOne.ServerReport.ReportServerUrl = New System.Uri(sUrl) 
    Me.rptOne.ServerReport.ReportPath = sPath 

Another example here

+0

好吧。我得到了这个部分,但我在哪里获得我的报告的URL?就像您在展示的链接中一样,我如何使用Web界面创建报表服务器实例。 – user194076

+1

@imAbhi:Plz dnt uz txtspk。 –

+0

@user Asuming你已经安装了MS报表服务器,你可以将它发布到一个文件夹并设置一个path.refer这个http://stackoverflow.com/questions/5191297/how-to-deploy-ssrs-on-local – imAbhi

1

SQL Server报表服务(SSRS)安装微软SQL Server的一部分。您需要使用SQL Server安装介质来安装SSRS。您可以安装仅安装SSRS而无需其他SQL Server组件,但您需要有一个SQL Server来存储SSRS保存其数据的数据库。

我没有与下端选项太多的经验,但SSRS可与“SQL Server Express with Advanced Services

0

不是很多文档的报告是有用的,但更难以再 SQL Server报表服务(SSRS)让一个类在这个代码片段中传递整个报表查看器rpt =报告查看器传入堆中: rpt.LocalReport.DataSources.Clear();

Microsoft.Reporting.WebForms.ReportDataSource rptdTitle = new Microsoft.Reporting.WebForms.ReportDataSource(); 
    rptdTitle.Name = "DataSet1"; 
    rptdTitle.Value = dt2; 
    rpt.LocalReport.DataSources.Add(rptdTitle); 

    Microsoft.Reporting.WebForms.ReportDataSource rptdTop = new Microsoft.Reporting.WebForms.ReportDataSource(); 
    rptdTop.Name = "DataSet2"; 
    rptdTop.Value = dt1; 
    rpt.LocalReport.DataSources.Add(rptdTop); 


    Microsoft.Reporting.WebForms.ReportDataSource rptDate = new Microsoft.Reporting.WebForms.ReportDataSource(); 
    rptDate.Name = "DataSet3"; 
    rptDate.Value = dsTableDate; 
    rpt.LocalReport.DataSources.Add(rptDate); 



    Microsoft.Reporting.WebForms.ReportDataSource rptTable = new Microsoft.Reporting.WebForms.ReportDataSource(); 
    rptTable.Name = "DataSet4"; 
    rptTable.Value = dtReport; 
    rpt.LocalReport.DataSources.Add(rptTable); 

    rpt.LocalReport.ReportPath = System.Web.HttpContext.Current.Server.MapPath(@"~\Reports\rptPeriodTotals.rdlc"); 

    rpt.LocalReport.Refresh();