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

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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
 
Back
Top