我希望在页面加载时报告应该显示所有记录。现在,当我想按日期(组字段)显示过滤器记录时,即显示所有不带过滤器的记录,否则显示带过滤器的记录。
当我想过滤数据时,我的代码如下
protected void click(object sender, EventArgs e)
{
ReportDocument cryRpt = new ReportDocument();
cryRpt.Load(Server.MapPath("report.rpt"));
cryRpt.SetDatabaseLogon("userid", "password", "server", "database");
ParameterFieldDefinitions crParameterFieldDefinitions;
ParameterFieldDefinition crParameterFieldDefinition;
ParameterValues crParameterValues = new ParameterValues();
ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();
crParameterDiscreteValue.Value =Convert.ToDateTime( dtAppt.Text).ToShortDateString();
crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields;
crParameterFieldDefinition = crParameterFieldDefinitions["stdate"];
crParameterValues = crParameterFieldDefinition.CurrentValues;
crParameterValues.Add(crParameterDiscreteValue);
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);
CrystalReportViewer1.ReportSource = cryRpt;
Checkbox1.Checked = false;
}
在 if 条件中写什么,以便我可以获得所有记录以及在下面这一行中传递什么?
crParameterDiscreteValue.Value =Convert.ToDateTime( dtAppt.Text).ToShortDateString();