Methoun Ahmed

Methoun Ahmed

  • NA
  • 145
  • 101.9k

How to pass date time parameter value in crystal report

Aug 13 2018 1:46 AM
Show the error "Additional information: Procedure or function 'RptDetails' expects parameter '@Date1', which was not supplied."
Here is my code
 
void DisplayReport()
{
con.Open();
SqlCommand cmd = new SqlCommand("RptDetails", con);
cmd.CommandType = CommandType.StoredProcedure;
SqlDataAdapter sda = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
sda.Fill(dt);
crypt.Load(Server.MapPath("DetailsRep.rpt"));
crypt.SetDataSource(dt);
crypt.SetParameterValue("Date1", datepicker.ToString());
crypt.SetParameterValue("Date2", datepicker2.ToString());
crypt.SetParameterValue("User", lblUser.Text);
CrystalReportViewer1.ReportSource = crypt;
CrystalReportViewer1.DataBind();
con.Close();

Answers (1)