i am in between very complex situation. I am filling a report with one record only from store procedure which only requires one parameter and select record on basis of it e.g. @complaintCode. Now requirements has changed, it should load multiple records i.e. i have two dates textboxes which picks only complaint codes which falls between those dates e.g. 20 complaint codes, now my rdlc should display all records for all complaint codes that has been loaded into dataset.
To make my issue simple: 1. Enter 2 dates and click search, it loads many complaint codes between date range and put in dataset. 2. Now i WANT to fill dataset from store procedure which takes only one parameter i.e. complaint code and loading all records in rdlc report, how ?
Code:
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;
}
}