從報表服務器訪問報表時出現以下錯誤。我使用的是Windows應用程序來訪問我的report.This是我的代碼:在Windows應用程序中從報表服務器訪問報表服務(遠程模式)時出錯
private void rptviewer_Click(object sender, EventArgs e)
{
string reportName = "Crime_Traking_Report";
string reporturl = @"http://13.800.91.136/ReportServer";
string reportpath = @"/iSROReportsRK7/";
reportViewer1.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Remote;
reportViewer1.ServerReport.ReportServerCredentials = new ReportServerCredentials("isro", "password1209083$", "Rocket");
try
{
reportViewer1.ServerReport.ReportServerUrl = new Uri(reporturl);
}
catch (UriFormatException)
{
Console.WriteLine("Bad Url format");
}
reportViewer1.ServerReport.ReportPath = reportpath + reportName;
reportViewer1.ProcessingMode = ProcessingMode.Remote;
reportViewer1.ServerReport.Refresh();
}
public class ReportServerCredentials : IReportServerCredentials
{
private string _UserName;
private string _PassWord;
private string _DomainName;
public ReportServerCredentials(string UserName, string PassWord, string DomainName)
{
_UserName = UserName;
_PassWord = PassWord;
_DomainName = DomainName;
}
public System.Security.Principal.WindowsIdentity ImpersonationUser
{
get { return null; }
}
public ICredentials NetworkCredentials
{
get { return new NetworkCredential(_UserName, _PassWord, _DomainName); }
}
public bool GetFormsCredentials(out Cookie authCookie, out string user,out string password, out string authority)
{
authCookie = null;
user = password = authority = null;
return false;
}
}
的錯誤,我得到的是:錯誤1屬性或索引「Microsoft.Reporting.WinForms.ServerReport.ReportServerCredentials」不能被分配到 - 它是隻讀
錯誤2無法隱式轉換類型「Daily_Crime_Traking.Form1.ReportServerCredentials」到「Microsoft.Reporting.WinForms.ReportServerCredentials」
我試圖通過改變類名CustomServerCRedintials序,以避免nameConflict問題,那麼也相同種類的錯誤我想要解決這個問題。
這裏我沒有任何數據集,現在用遠程方法,而不是本地method.its不工作.. – RnR
Name是要爲其設置憑據的DataSource的名稱。報告中是否有數據源? – IvanH