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 933:    public string getclassname(int id)
Line 934:    {
Line 935:        return co.DQLOperate("select mc from newsclass_tb where id=" + id).Tables[0].Rows[0][0].ToString();
Line 936:    }
Line 937:    public string getnewsstr(int id)

Source File: d:\www\wwwroot\App_Code\operation.cs    Line: 935

Stack Trace:


[IndexOutOfRangeException: There is no row at position 0.]
   System.Data.RBTree`1.GetNodeByIndex(Int32 userIndex) +1649146
   System.Data.DataRowCollection.get_Item(Int32 index) +21
   operation.getclassname(Int32 id) in d:\www\wwwroot\App_Code\operation.cs:935
   ASP.hp_nry_aspx.__Renderform1(HtmlTextWriter __w, Control parameterContainer) in d:\www\wwwroot\hp-nry.aspx:119
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +109
   System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter writer) +173
   System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) +31
   System.Web.UI.HtmlControls.HtmlForm.Render(HtmlTextWriter output) +53
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
   System.Web.UI.HtmlControls.HtmlForm.RenderControl(HtmlTextWriter writer) +40
   ASP.hp_nry_aspx.__Render__control1(HtmlTextWriter __w, Control parameterContainer) in d:\www\wwwroot\hp-nry.aspx:12
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +109
   System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
   System.Web.UI.Page.Render(HtmlTextWriter writer) +29
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3060


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