public ActionResult Report(FormCollection form) { try { var datefrom = Request.Form["datefrom"].ToString(); var dateto = Request.Form["dateto"].ToString(); string fromdateString = datefrom.Trim(); string todateString = dateto.Trim(); string format = "dd/MM/yyyy"; CultureInfo provider = CultureInfo.InvariantCulture; DateTime fd = DateTime.ParseExact(fromdateString, format, provider); DateTime td = DateTime.ParseExact(todateString, format, provider); var pat = db.SP_PatientReport(fd, td); return(View(pat)); } catch (Exception ex) { return(View()); } }