2011-11-30 31 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();