VS.NET tell me no row, but there is...

G

Guest

When I try to grab a row from my table like this

rowTest = MyClass.DataSet11.Tables(0).Rows(0).Item(0

it tells me that "An unhandled exception of type 'System.IndexOutOfRangeException' occurred in system.data.dl

Additional information: There is no row at position 0.

I try other positions in the row and have the same effect, what is going on

Thanks
Ros
 
W

William Ryan eMVP

Ross:
It looks like you don't have any rows in your datatable.

Right before you call this code insert this:

Debug.Assert(MyClass.DataSet11.Tables(0).Rows.Count > 0)

If you don't get a bit ugly box (indicating the assertion failed) then
there's some other problem, but from the exception message, it looks like
there's nothing in Tables(0).Rows(0) because there's no row 0. Also, make
sure you are referencing the table you think you are...(probably a dumb
point but I mention it just in case).

HTH,

Bill
Ross said:
When I try to grab a row from my table like this

rowTest = MyClass.DataSet11.Tables(0).Rows(0).Item(0)

it tells me that "An unhandled exception of type
'System.IndexOutOfRangeException' occurred in system.data.dll
 

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