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

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
 
J

Jon Skeet [C# MVP]

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top