Server Error in '/' Application.

Conversion failed when converting date and/or time from character string.

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.Data.SqlClient.SqlException: Conversion failed when converting date and/or time from character string.

Source Error:


Line 709:if (allaVar == null) {
Line 710:    sqlAllaVar = sqlAllaVar + " ORDER BY Varinfo.SortNr1,Varinfo.SortNr2,Varinfo.SortNr3";
Line 711:    allaVar = db.Query(sqlAllaVar,startDatum,slutDatum,valdEgenskapId,egenskapSortering,orgKort);
Line 712:    if (allaVar != null) {
Line 713:        WebCache.Set(cacheItemKey, allaVar, 82, false);

Source File: d:\w005864\lediglogi.se\WWWRoot\oppettider.cshtml    Line: 711

Stack Trace:


[SqlException (0x80131904): Conversion failed when converting date and/or time from character string.]
   System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +2586982
   System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +6040034
   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +297
   System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) +4477
   System.Data.SqlClient.SqlDataReader.TryHasMoreRows(Boolean& moreRows) +242
   System.Data.SqlClient.SqlDataReader.TryReadInternal(Boolean setTimeout, Boolean& more) +275
   System.Data.SqlClient.SqlDataReader.Read() +35
   System.Data.Common.DbEnumerator.MoveNext() +38
   WebMatrix.Data.<QueryInternal>d__0.MoveNext() +203
   System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) +186
   System.Linq.Enumerable.ToList(IEnumerable`1 source) +61
   WebMatrix.Data.Database.Query(String commandText, Object[] parameters) +97
   ASP._Page_oppettider_cshtml.Execute() in d:\w005864\lediglogi.se\WWWRoot\oppettider.cshtml:711
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +197
   System.Web.WebPages.WebPage.ExecutePageHierarchy(IEnumerable`1 executors) +69
   System.Web.WebPages.WebPage.ExecutePageHierarchy() +131
   System.Web.WebPages.StartPage.RunPage() +17
   System.Web.WebPages.StartPage.ExecutePageHierarchy() +64
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +78
   System.Web.WebPages.WebPageHttpHandler.ProcessRequestInternal(HttpContextBase httpContext) +116


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