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 29:                 lbPrice.Text = "Liên hệ";
Line 30:             }
Line 31:             lbPricePromotion.Text = ProcessBeauty.GetPrice(ConvertType.ToInt(Product.GetProductFromIDSelected(productID).PricePromotion));
Line 32:             if (ConvertType.ToInt(Product.GetProductFromIDSelected(productID).PricePromotion)<=0)
Line 33:             {

Source File: c:\inetpub\vhosts\hoatuoiyhoa.com\httpdocs\ChiTietSanPham.aspx.cs    Line: 31

Stack Trace:


[InvalidOperationException: Sequence contains no elements]
   System.Linq.Enumerable.First(IEnumerable`1 source) +269
   System.Data.Objects.ELinq.ObjectQueryProvider.<GetElementFunction>b__0(IEnumerable`1 sequence) +40
   System.Data.Objects.ELinq.ObjectQueryProvider.ExecuteSingle(IEnumerable`1 query, Expression queryRoot) +59
   System.Data.Objects.ELinq.ObjectQueryProvider.System.Linq.IQueryProvider.Execute(Expression expression) +133
   System.Data.Entity.Internal.Linq.DbQueryProvider.Execute(Expression expression) +87
   System.Linq.Queryable.First(IQueryable`1 source, Expression`1 predicate) +287
   MyDatabase.Product.GetProductFromIDSelected(Int32 id) +444
   ChiTietSanPham.Page_Load(Object sender, EventArgs e) in c:\inetpub\vhosts\hoatuoiyhoa.com\httpdocs\ChiTietSanPham.aspx.cs:31
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +51
   System.Web.UI.Control.OnLoad(EventArgs e) +92
   System.Web.UI.Control.LoadRecursive() +54
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +772


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