Server Error in '/' Application.

Index 0 is either negative or above rows count.

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: Index 0 is either negative or above rows count.

Source Error:


Line 40:                 " WHERE CAT_ID_CATEGORIA = '" + ((DataView)SqlDataSourceCategorie.Select(DataSourceSelectArguments.Empty))[i]["ID"].ToString() + "' ";
Line 41:             
Line 42:             foto = "<img style='border-top-left-radius: 8px; border-top-right-radius: 8px;' src='" + ((DataView)SqlDataSourceMarche.Select(DataSourceSelectArguments.Empty))[0]["IMM_IMMAGINE"].ToString() + "' width='100%' />";
Line 43: 
Line 44: 

Source File: d:\home\s01473.winp029.arubabusiness.it\ivanoborghi.it\Prodotti.aspx.cs    Line: 42

Stack Trace:


[IndexOutOfRangeException: Index 0 is either negative or above rows count.]
   System.Data.DataView.GetRow(Int32 index) +1901414
   System.Data.DataView.get_Item(Int32 recordIndex) +14
   Prodotti.Page_Load(Object sender, EventArgs e) in d:\home\s01473.winp029.arubabusiness.it\ivanoborghi.it\Prodotti.aspx.cs:42
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +52
   System.Web.UI.Control.OnLoad(EventArgs e) +97
   System.Web.UI.Control.LoadRecursive() +61
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +693


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