Server Error in '/' Application.

Sequence contains more than one element

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 more than one element

Source Error:


Line 20:         else
Line 21:         {
Line 22:             info = wdb.NewsInfo.SingleOrDefault(n => n.NewsKey == key);
Line 23:             if (info == null)
Line 24:                 Response.End();

Source File: d:\www\web\welldonepcb1\wwwroot\cn\NewsDetail.aspx.cs    Line: 22

Stack Trace:


[InvalidOperationException: Sequence contains more than one element]
   System.Data.Linq.SqlClient.SqlProvider.Execute(Expression query, QueryInfo queryInfo, IObjectReaderFactory factory, Object[] parentArgs, Object[] userArgs, ICompiledSubQuery[] subQueries, Object lastResult) +1144
   System.Data.Linq.SqlClient.SqlProvider.ExecuteAll(Expression query, QueryInfo[] queryInfos, IObjectReaderFactory factory, Object[] userArguments, ICompiledSubQuery[] subQueries) +115
   System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(Expression query) +355
   System.Data.Linq.Table`1.System.Linq.IQueryProvider.Execute(Expression expression) +52
   System.Linq.Queryable.SingleOrDefault(IQueryable`1 source, Expression`1 predicate) +296
   NewsDetail.Page_Load(Object sender, EventArgs e) in d:\www\web\welldonepcb1\wwwroot\cn\NewsDetail.aspx.cs:22
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +46
   System.Web.UI.Control.OnLoad(EventArgs e) +83
   System.Web.UI.Control.LoadRecursive() +120
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3927


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