WinForm 訪問 SQL Server 報表服務的憑據轉換

       使用.Net 開發Windows應用程序,使用ReportView控件可以訪問報表服務器上的報表,System.Net.NetWorkCredentials 在Visual Studio 2008中可以隱式轉換爲ReportServerCredentials
        下面是一個WinForm訪問報表服務的範例:
         ReportUser 是一個有報表服務訪問權限的Windows用戶
         System.Net.NetworkCredential("ReportUser", "password", "")中的三個參數分別是:報表服務訪問賬號、密碼和域名;如果是本地賬號,域名可以爲空。
 
 
            this.reportViewer1.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Remote;
            this.reportViewer1.ServerReport.ReportServerUrl = new System.Uri("http://192.168.3.61/reportserver");
            this.reportViewer1.ServerReport.ReportPath = "/羅斯文銷售部報表/5-銷售分析報表(矩陣,參數)";
            this.reportViewer1.ServerReport.ReportServerCredentials.NetworkCredentials
                    = new System.Net.NetworkCredential("ReportUser", "password", "");
            this.reportViewer1.RefreshReport();
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章