2016-03-22 20 views
0

私はクリスタルレポートにテキストボックスの値を渡したいと思います。パラメータフィールドに "JoiningDate"という名前のパラメータを1つ追加し、そのパラメータフィールドを.rptファイル{?JoiningDate}に追加しました。私のパラメータをコードの後ろに追加する方法。クリスタルレポートにテキストボックスの値を渡す方法は?

ReportDocument crystalReport = new ReportDocument(); 
    crystalReport.Load(Server.MapPath("~/ExperienceLetter.rpt")); 
    DataSet dsCustomers = GetData("select top 1 * from employees"); 
    crystalReport.SetDataSource(dsCustomers); 
    CrystalReportViewer1.ReportSource = crystalReport; 
    string dateValue = txtJoiningDate.Text; 
    crystalReport.SetParameterValue("@JoiningDate", dateValue);   

答えて

1

テキスト値を表示したい場合は、以下のコードを使用してください。

TextObject txtObj = (TextObject)crystalReport.ReportDefinition.Sections["GroupHeaderSection1"].ReportObjects["Text10"]; 

が、いくつかのロジックや計算の使用モデルは、結合のための

... ログイン: http://tektutorialshub.com/how-to-create-crystal-report-using-visual-studio/

+0

エラーが表示されます - 無効なインデックスです。 (HRESULTからの例外:0x8002000B(DISP_E_BADINDEX)) –

0
TextObject text = (TextObject)cr.ReportDefinition.Sections["Section3"].ReportObjects["Text1"]; 
text.Text = textBox1.Text; 

hereは、それを説明する簡単な例です。

関連する問題