2012-05-02 6 views
0

中でレポートサーバーからレポートサービス(リモートモード)にアクセスしながら、私はエラーを次しまいました。私は私のreport.ThisにアクセスするためのWindowsアプリケーションを使用しています私のコードです:私が得た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は」に割り当てることはできません - それは暗黙的に型「Daily_Crime_Traking.Form1.ReportServerCredentials」を変換できませんだけ
エラー2を読まれる「Microsoft.Reporting.WinForms.ReportServerCredentials」

私もその後、nameConflictの問題を回避するために、順序どおりCustomServerCRedintialsにクラス名を変更してみました同じ種類のエラー、私はこの問題を解決するために何をしたいですか。

私は

reportViewer1.ServerReport.SetDataSourceCredentials({ new DataSourceCredentials { 
    Name = _DataSourceName, 
    UserId =_UserName, 
    Password = _PassWord 
} }) 

参照の資格情報を設定するためにこれを使用

答えて

関連する問題