Server Error in '/' Application.

There is no row at position 0.

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.IndexOutOfRangeException: There is no row at position 0.

Source Error:


Line 43:             string LenhCate = @"Select ProGID, ProGName From tbl_ProductGroup Where ProGShow=1 and ProGStyle=0 and ProGID=" + Convert.ToInt32(PrID);
Line 44:             BANG_tbl_ProductGroup dtbcate = new BANG_tbl_ProductGroup(LenhCate);
Line 45:             lblName.Text = dtbcate.Rows[0]["ProGName"].ToString().Trim();
Line 46:             // Lay danh sach
Line 47:             string LenhSQL = @"SELECT ProID, ProName, ProImage, ProLong, ProGID FROM tbl_Product WHERE ProShow=1 and ProStyle=0 and ProGID=" + Convert.ToInt32(PrID) + " and ProID=" + Convert.ToInt32(ID).ToString();

Source File: d:\inetpub\vhosts\spchcmc.vn\httpdocs\VN\SanPhamDetail.ascx.cs    Line: 45

Stack Trace:


[IndexOutOfRangeException: There is no row at position 0.]
   System.Data.RBTree`1.GetNodeByIndex(Int32 userIndex) +2126463
   System.Data.DataRowCollection.get_Item(Int32 index) +21
   VN_SanPhamDetail.LoadData() in d:\inetpub\vhosts\spchcmc.vn\httpdocs\VN\SanPhamDetail.ascx.cs:45
   VN_SanPhamDetail.Page_Load(Object sender, EventArgs e) in d:\inetpub\vhosts\spchcmc.vn\httpdocs\VN\SanPhamDetail.ascx.cs:18
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +51
   System.Web.UI.Control.OnLoad(EventArgs e) +95
   System.Web.UI.Control.LoadRecursive() +59
   System.Web.UI.Control.LoadRecursive() +131
   System.Web.UI.Control.LoadRecursive() +131
   System.Web.UI.Control.LoadRecursive() +131
   System.Web.UI.Control.LoadRecursive() +131
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +678


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