【发布时间】:2014-08-28 10:47:56
【问题描述】:
我处于非常复杂的情况之间。我正在用仅来自存储过程的一条记录填充报告,该记录只需要一个参数并根据它选择记录,例如@投诉代码。现在要求已经改变,它应该加载多个记录,即我有两个日期文本框,它们只选择介于这些日期之间的投诉代码,例如20 个投诉代码,现在我的 rdlc 应该显示已加载到数据集中的所有投诉代码的所有记录。
为了让我的问题变得简单: 1.输入2个日期,点击搜索,在日期范围内加载多个投诉代码并放入数据集中。 2. 现在我想从存储过程中填充数据集,它只需要一个参数,即投诉代码并加载 rdlc 报告中的所有记录,如何?
代码:
protected void btnGenReport_Click(object sender, EventArgs e)
{
try
{
DateTime fromDate = DateTime.ParseExact(txtFromDate.Text, "dd/MMM/yyyy", null);
DateTime toDate = DateTime.ParseExact(txtToDate.Text, "dd/MMM/yyyy", null);
DataTable dt_temp = MyComplaints.SearchAllComplaintByDate(fromDate, toDate);
ReportViewer1.ProcessingMode = ProcessingMode.Local;
ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/Reports/Report_Complaints24Hours_Sdpo.rdlc");
string ComplaintCode = Convert.ToString(txtComplaintCode.Text);
DataTable dt = ManageRecievedMessage.Report_Complaints24Hours_Sdpo(ComplaintCode);
if (dt.Rows.Count <= 0)
{
HiddenFieldSetMessage.Value = "WrongDatesComb";
HiddenFieldShowMessage.Value = "True";
ReportViewer1.Visible = false;
}
else
{
ReportDataSource rpds = new ReportDataSource("DataSet1", dt);
ReportViewer1.LocalReport.DataSources.Clear();
ReportViewer1.LocalReport.DataSources.Add(rpds);
ReportViewer1.Visible = true;
}
}
【问题讨论】: