本文介绍了两个DateTimePickers C#的水晶报告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个包含Crystal Report Viewer的表单,顶部有两个DateTimePickers和button1,当我运行此代码并选择日期并单击按钮时,查看器上只显示coulmns名称的数据。
I have a form which contain the Crystal Report Viewer and on the top there are two DateTimePickers and button1, When I run this code and choose the dates and click on the button, no data appear on the viewer only the coulmns names.
private void button1_Click(object sender, EventArgs e)
{
ByName cryrpt = new ByName();
cryrpt.Load(@"C:*******************ByName.rpt");
ParameterFields pfields = new ParameterFields();
ParameterField pfield = new ParameterField();
ParameterDiscreteValue pdisc = new ParameterDiscreteValue();
ParameterField pfield1 = new ParameterField();
ParameterDiscreteValue pdisc1 = new ParameterDiscreteValue();
pfield.Name = "start_Date";
pdisc.Value = FirstDate;
pfield.CurrentValues.Add(pdisc);
pfields.Add(pfield);
pfield1.Name = "End_Date";
pdisc1.Value = SecondDate;
pfield1.CurrentValues.Add(pdisc1);
pfields.Add(pfield1);
crystalReportViewer1.ReportSource = cryrpt;
crystalReportViewer1.ParameterFieldInfo = pfields;
FirstDate = dateTimePicker1.Value;
SecondDate = dateTimePicker2.Value;
crystalReportViewer1.ReportSource = cryrpt;
crystalReportViewer1.Refresh();
}
推荐答案
这篇关于两个DateTimePickers C#的水晶报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!