2016-11-23 6 views
0

datasourceのレポートを特定のメソッドの戻り値に設定したいのですが、レポートウィザードは自分のメソッドを検出できません。RDLCのデータソースを特定のメソッドの戻り値に設定する方法

enter image description here

方法はDataLayer名前空間と別のクラスライブラリ(FinanceReportBundle)の私のレポートにクラスUtilityです。

クラスは、そののようなものです:

namespace DataLayer 
{ 

    public class Utility 
    { 

     public static IEnumerable<object> GetAnalysisDataForConsecutiveYears(int year, int periodTypeId, int period) 
     { 
      ////Business 
     } 
    } 

} 

答えて

1

あなたはデザイナーでそれを行う必要はありません。

var dataSource = getmyDataSource(); 
var rds = new ReportDataSource("myDataSourceName", dataSource); 
this.reportViewer1.LocalReport.DataSources.Add(rds); 
this.reportViewer1.LocalReport.ReportPath = "path your your rdlc"; 
this.reportViewer1.RefreshReport(); 
コードのデータソースを簡単に設定できます。
関連する問題