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 75:         string sql = "select " + name + " from  " + table + " where " + condition + "=" + Convert.ToInt32(id);
Line 76:         DataSet ds = db.GetDataSet(sql);
Line 77:         string neirong = ds.Tables[0].Rows[0][name].ToString();
Line 78:         return neirong;
Line 79:     }

Source File: d:\safeDogSite\www.dachonghongmu.com\App_Code\ggetcontent.cs    Line: 77

Stack Trace:


[IndexOutOfRangeException: There is no row at position 0.]
   System.Data.RBTree`1.GetNodeByIndex(Int32 userIndex) +2483230
   System.Data.DataRowCollection.get_Item(Int32 index) +21
   ggetcontent.bydirect(String id, String name, String table, String condition) in d:\safeDogSite\www.dachonghongmu.com\App_Code\ggetcontent.cs:77
   ASP.search_soproduct_aspx.__Render__control1(HtmlTextWriter __w, Control parameterContainer) in d:\safeDogSite\www.dachonghongmu.com\search\soproduct.aspx:11
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +131
   System.Web.UI.Page.Render(HtmlTextWriter writer) +40
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5290


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