C# 如何将文本框值传递给crystal report?
我想将文本框值传递给crystal report。我在参数字段中添加了一个名为“JoiningDate”的参数,并在.rpt文件{?JoiningDate}中添加了该参数字段。如何在代码隐藏中添加我的参数C# 如何将文本框值传递给crystal report?,c#,crystal-reports,C#,Crystal Reports,我想将文本框值传递给crystal report。我在参数字段中添加了一个名为“JoiningDate”的参数,并在.rpt文件{?JoiningDate}中添加了该参数字段。如何在代码隐藏中添加我的参数 ReportDocument crystalReport = new ReportDocument(); crystalReport.Load(Server.MapPath("~/ExperienceLetter.rpt")); DataSet dsCustomers = Ge
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);
如果您只想显示文本值,我最好使用下面的代码
TextObject txtObj = (TextObject)crystalReport.ReportDefinition.Sections["GroupHeaderSection1"].ReportObjects["Text10"];
但对于某些逻辑或计算,使用模型绑定。。
访问:如果您只想显示文本值,我建议使用下面的代码
TextObject txtObj = (TextObject)crystalReport.ReportDefinition.Sections["GroupHeaderSection1"].ReportObjects["Text10"];
但对于某些逻辑或计算,使用模型绑定。。
访问:
这是一个简单的例子
这是一个简单的例子来解释它。给我错误-索引无效。(HRESULT的异常:0x8002000B(DISP_E_BADINDEX))给我错误-索引无效。(HRESULT的例外:0x8002000B(显示索引))