如何在asp.net C#中的水晶报表中将文本框值作为参数传递?
我想要显示passparamter步骤的示例 我尝试了很多例子但没有输出.. 我想在下面链接 http://csharp.net-informations.com/crystal-reports/csharp-crystal-reports-string-parameter.htm 但是没有数据显示
请帮忙
答案 0 :(得分:1)
试试这段代码
ReportDocument reportDocument = new ReportDocument();
ParameterFields paramFields = new ParameterFields();
ParameterField paramField = new ParameterField();
ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue();
paramField.Name = "@CustomerName";
paramDiscreteValue.Value = TextBox1.Text.ToString();
paramField.CurrentValues.Add(paramDiscreteValue);
paramFields.Add(paramField);
CrystalReportViewer1.ParameterFieldInfo = paramFields;
reportDocument.Load(Server.MapPath("CrystalReport.rpt"));
CrystalReportViewer1.ReportSource = reportDocument;
答案 1 :(得分:0)
我希望这会有所帮助:
ReportDocument cryReportDocument = .......;
cryReportDocument.SetDatabaseLogon("userName", "password");
cryReportDocument.SetParameterValue("parameterName", yourTextBoxName.Text);
CrystalReportViewer1.ReportSource = cryReportDocument;