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 50:                     DataTable dttype = BusinessLogic.ReturnDt("select  * from system_ProductTypes where ID=" + dtNews.Rows[0]["ClassId"] + " and  ID<>0 order by Sort asc,ID desc");
Line 51:                     this.Page.Header.Title ="产品展示-" + webset.WebTitle;
Line 52:                     name = "<a href='Products.aspx?cid=" + dtNews.Rows[0]["ClassId"] + "'>" + dttype.Rows[0]["Title"].ToString() + "</a>";
Line 53:                     names = dttype.Rows[0]["Title"].ToString();
Line 54: 

Source File: d:\1\v4089462\wwwroot\ProductDetail.aspx.cs    Line: 52

Stack Trace:


[IndexOutOfRangeException: There is no row at position 0.]
   System.Data.RBTree`1.GetNodeByIndex(Int32 userIndex) +1678426
   System.Data.DataRowCollection.get_Item(Int32 index) +21
   ProductDetail.Page_Load(Object sender, EventArgs e) in d:\1\v4089462\wwwroot\ProductDetail.aspx.cs:52
   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) +91
   System.Web.UI.Control.LoadRecursive() +74
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2207


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