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 8:      {
Line 9:          mainDataContext db = new mainDataContext();
Line 10:         product prod = db.products.Single(p => p.productID == int.Parse(Request.QueryString["id_prod"]));
Line 11:         Response.Status = "301 Moved Permanently";
Line 12:         Response.AddHeader("Location", "../../" + helpers.productLink(prod.productID, prod.InCat_id).Replace("~/", ""));

Source File: c:\HostingSpaces\aviyaffe\aviyaffe.com\wwwroot\store\main\producat_ver.aspx    Line: 10

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) +847
   System.Data.Linq.SqlClient.SqlProvider.ExecuteAll(Expression query, QueryInfo[] queryInfos, IObjectReaderFactory factory, Object[] userArguments, ICompiledSubQuery[] subQueries) +113
   System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(Expression query) +344
   System.Data.Linq.Table`1.System.Linq.IQueryProvider.Execute(Expression expression) +49
   System.Linq.Queryable.Single(IQueryable`1 source, Expression`1 predicate) +301
   ASP.store_main_producat_ver_aspx.Page_Load(Object sender, EventArgs e) in c:\HostingSpaces\aviyaffe\aviyaffe.com\wwwroot\store\main\producat_ver.aspx:10
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
   System.Web.UI.Control.OnLoad(EventArgs e) +99
   System.Web.UI.Control.LoadRecursive() +50
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627


Version Information: Microsoft .NET Framework Version:2.0.50727.8806; ASP.NET Version:2.0.50727.8762