You will get this error normally if your datasource doesn't contains any records. Check the data of the
dataset ds
in your code while tracing. Always check the dataset before comparison like below.
bl.Fetch(ds, RowId);
if (ds!= null)
{
if (ds.Tables.Count > 0)
{
if (ds.Tables[bl.SqlEntityX].Rows.Count > 0)
{
Response.Redirect("~/Login/Login.aspx?" + "ReturnURL=" + Request.Url.ToString());
}
}
}
else
{
Response.Redirect("No data");
}
BTW Check that can you get values for
RowId
& also the
Fetch()
too.