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 122:    End Sub
Line 123:    Private Function getCategoryID(ByVal db As Product_MainDataContext, ByVal CategoryLookupID As Integer) As Guid
Line 124:        Return (From s In db.Categories Where s.LookupID = CategoryLookupID Select s.CategoryID).Single
Line 125:    End Function
Line 126:

Source File: \\fs6-n01\stor0wc2dfw1\443490\741331\www.drum-line.com\web\content\Category.aspx.vb    Line: 124

Stack Trace:


[InvalidOperationException: Sequence contains no elements]
   System.Data.Linq.SqlClient.SqlProvider.Execute(Expression query, QueryInfo queryInfo, IObjectReaderFactory factory, Object[] parentArgs, Object[] userArgs, ICompiledSubQuery[] subQueries, Object lastResult) +1168
   System.Data.Linq.SqlClient.SqlProvider.ExecuteAll(Expression query, QueryInfo[] queryInfos, IObjectReaderFactory factory, Object[] userArguments, ICompiledSubQuery[] subQueries) +118
   System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(Expression query) +342
   System.Data.Linq.DataQuery`1.System.Linq.IQueryProvider.Execute(Expression expression) +29
   System.Linq.Queryable.Single(IQueryable`1 source) +152
   Category.getCategoryID(Product_MainDataContext db, Int32 CategoryLookupID) in \\fs6-n01\stor0wc2dfw1\443490\741331\www.drum-line.com\web\content\Category.aspx.vb:124
   Category.Page_Load(Object sender, EventArgs e) in \\fs6-n01\stor0wc2dfw1\443490\741331\www.drum-line.com\web\content\Category.aspx.vb:65
   System.Web.UI.Control.OnLoad(EventArgs e) +95
   System.Web.UI.Control.LoadRecursive() +59
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +678


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