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 93:     var data = db.Query("SELECT Players.FirstName, Players.Surname, Fielding.Catches, Fielding.Stumpings, Fielding.RunOuts FROM Fielding INNER JOIN Players ON Players.ID = Fielding.PlayerID WHERE Team= @0 AND Season= @1 AND League=@2 ORDER BY Catches DESC", team, season, leagueSQL);
Line 94:     //var data = db.Query("SELECT Date, Time, Opposition, Location, Format, PutneyScore, PutneyWickets, OppositionScore, OppositionWickets, Result, Points, Toss FROM Fixtures WHERE Team = @0 AND Year(Date)=@1 ORDER BY DATE", team, season);
Line 95:     var columns = data.First().Columns;
Line 96: 
Line 97:     var doc = new Document();

Source File: d:\hostingspaces\benbrook\putneycricketclub.com\wwwroot\stats\fielding\GeneratePdf.cshtml    Line: 95

Stack Trace:


[InvalidOperationException: Sequence contains no elements]
   System.Linq.Enumerable.First(IEnumerable`1 source) +335
   ASP._Page_stats_fielding_GeneratePdf_cshtml.Execute() in d:\hostingspaces\benbrook\putneycricketclub.com\wwwroot\stats\fielding\GeneratePdf.cshtml:95
   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