Server Error in '/' Application.

String was not recognized as a valid DateTime.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.FormatException: String was not recognized as a valid DateTime.

Source Error:


Line 612:            oParameter[5] = new SqlParameter("@Title", string.IsNullOrEmpty(Title) ? (object)DBNull.Value : Title);
Line 613:            oParameter[6] = new SqlParameter("@Year", string.IsNullOrEmpty(Year) ? (object)DBNull.Value : Year);
Line 614:            oParameter[7] = new SqlParameter("@Month", string.IsNullOrEmpty(Month) ? (object)DBNull.Value : Convert.ToDateTime(Month));
Line 615:            oParameter[8] = new SqlParameter("@FromDate", string.IsNullOrEmpty(FromDate) ? (object)DBNull.Value : FromDate);
Line 616:            oParameter[9] = new SqlParameter("@ToDate", string.IsNullOrEmpty(ToDate) ? (object)DBNull.Value : ToDate);

Source File: d:\SATP_ORG\SATP\App_Code\BLL\UserFeatureListBLL.cs    Line: 614

Stack Trace:


[FormatException: String was not recognized as a valid DateTime.]
   System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles) +14545182
   System.Convert.ToDateTime(String value) +80
   Radix.BLL.UserFeatureListBLL.UserDataSheetPotentialThreatSelectDataAll(String SectionType, String SectionName, String Country, String Zone, String State, String District, String Title, String Year, String Month, String FromDate, String ToDate) in d:\SATP_ORG\SATP\App_Code\BLL\UserFeatureListBLL.cs:614
   data_Other_potential_threat.BindData(String SectionType, String SectionName, String CountryName, String Zone, String State, String District, String Title, String Year, String Month, String FromDate, String ToDate) in d:\SATP_ORG\SATP\data\Other\potential-threat.aspx.cs:271
   data_Other_potential_threat.Page_Load(Object sender, EventArgs e) in d:\SATP_ORG\SATP\data\Other\potential-threat.aspx.cs:45
   System.Web.UI.Control.OnLoad(EventArgs e) +106
   System.Web.UI.Control.LoadRecursive() +68
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3785


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.7.4081.0