你能告诉我将参数传递给 C# win 表单中的水晶报表 13 的步骤是什么吗?
我的代码:
//getting and set dataset to report
string sql = "select * from dbo.Trading_Order";
DataRetriever dr = new DataRetriever();
dr.getValueFromCustomer(sql);
DataTable dtSum = dr.getDataTable();
dsMyReprt k = new dsMyReprt();
k.Tables.Remove("dtMyTable");
dtSum.TableName = "dtMyTable";
k.Tables.Add(dtSum);
CrystalReport1 myDataReport = new CrystalReport1();
//pass parameter
ParameterFields paramFields = new ParameterFields();
// ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue();
ParameterField paramField = new ParameterField();
ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue();
paramField.Name = "@DTotal";
paramDiscreteValue.Value = tot;
paramField.CurrentValues.Add(paramDiscreteValue);
paramFields.Add(paramField);
paramField = new ParameterField();
paramDiscreteValue = new ParameterDiscreteValue();
paramField.Name = "@name";
paramDiscreteValue.Value = name;
paramField.CurrentValues.Add(paramDiscreteValue);
paramFields.Add(paramField);
crystalReportViewer1.ParameterFieldInfo = paramFields;
myDataReport.SetDataSource(k);
crystalReportViewer1.ReportSource = myDataReport;
获取和设置数据集部分正在工作,但传递参数部分不起作用