2017-12-13 39 views
0

私のrdlcレポートでは、パラメータテストを作成します。フォームで、私は、パラメータを設定するコードの下に書く:パラメータを設定するRDLCレポートC#

//Set Parameters 
ReportParameter[] p = new ReportParameter[1]; 
p[0] = new ReportParameter("Test", "Testing"); 
currentBilling_rv.LocalReport.SetParameters(p); 

// Provide datasource to report Current_Total_Billing.rdlc 
ReportDataSource rds = new ReportDataSource("CurrentTotalBilling", dataset.Tables[2]); 
currentTotalBilling_rv.LocalReport.DataSources.Clear(); 
currentTotalBilling_rv.LocalReport.DisplayName = "Current Total Billing"; 
currentTotalBilling_rv.LocalReport.ReportPath = ".\\Current_Total_Billing.rdlc"; 
currentTotalBilling_rv.LocalReport.DataSources.Add(rds); 
currentTotalBilling_rv.RefreshReport(); 

私は例外

はタイプ の未処理の例外「Microsoft.Reporting.WinForms.MissingReportSourceException」は、マイクロソフトで を発生しているプログラムを実行すると.ReportViewer.WinForms.dll

追加情報:レポート定義のソースは が指定されていません

助けてください。

+0

パラメータ関連のコードを削除すると機能しますか? – InitK

+0

はい、それはうまく動作します –

答えて

0

コードではReportViewerのパラメータをcurrentBilling_rvとし、次のコード行で使用されるcurrentTotalBilling_rvでは使用しません。

currentBilling_rvが正しい場合は、currentBilling_rv.LocalReport.ReportPathがコンパイルされていることを確認してください。

+0

はい、あなたは正しいです。レポートビューアの名前を修正します。しかし、まだ同じエラーに直面しています。それから私は "currentTotalBilling_rv.LocalReport.SetParameters(p);"データソースを提供した後。処理モードにエラーがあります。 –

関連する問題