Index 0 is not non-negative and below total rows count

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

When my web page returning no data I got a unhandled exception.
How can I handel this error?

IndexOutOfRangeException: Index 0 is not non-negative and below total rows
count.]
System.Data.DataView.GetElement(Int32 index) +43
System.Data.DataView.get_Item(Int32 recordIndex) +5
afgprojekt.Delete_external_user.bnDelExtUser_Click(Object sender,
EventArgs e) +520
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108

System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +58
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1292
 
clauschc said:
When my web page returning no data I got a unhandled exception.
How can I handel this error?

By not trying to get at data when it's not there. Use the
DataView.Count property to find out whether or not there are any
records.
 
Back
Top