Server Error in '/' Application.

Sequence contains no elements

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.InvalidOperationException: Sequence contains no elements

Source Error:


Line 55:     var db = Database.Open("PutneyCCConnectionString");
Line 56:     var data = db.Query("SELECT Date, Time, Teamname, Location, Format, PutneyScore, PutneyWickets, OppositionScore, OppositionWickets, Result, Points, Toss FROM Fixtures INNER JOIN Opponents ON Opponents.ID = Fixtures.opponentID WHERE Team = @0 AND Year(Date)=@1 ORDER BY DATE", team, season);
Line 57:     var columns = data.First().Columns;
Line 58: 
Line 59:     var doc = new Document();

Source File: d:\hostingspaces\benbrook\putneycricketclub.com\wwwroot\fixtures\GeneratePdf.cshtml    Line: 57

Stack Trace:


[InvalidOperationException: Sequence contains no elements]
   System.Linq.Enumerable.First(IEnumerable`1 source) +335
   ASP._Page_fixtures_GeneratePdf_cshtml.Execute() in d:\hostingspaces\benbrook\putneycricketclub.com\wwwroot\fixtures\GeneratePdf.cshtml:57
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +199
   System.Web.WebPages.WebPage.ExecutePageHierarchy(IEnumerable`1 executors) +73
   System.Web.WebPages.WebPage.ExecutePageHierarchy() +154
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +80
   System.Web.WebPages.WebPageHttpHandler.ProcessRequestInternal(HttpContextBase httpContext) +119


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