Search code examples
asp.netvb.netvb6eof

Equivalent of RecordSet.MoveNext while Not EOF in ASP.NET


I'm using a DataReader to display informations stored in a table.

I created Two button to go to next record and to go back.

In VB6 I used this code :

While Not Recordset1.EOF
Recordset1.MoveNext
End While

In ASP.NET I didn't find a way to do like it, because DataReader hasn't the EOF property.

EDIT :

While Not Recordset1.BOF
Recordset1.MovePrevious
End While

How can I convert this last code (VB6) to ASP.NET ??


Solution

  • You use Read instead of MoveNext and it'll return false if there aren't any more records. So:

    While rdr.Read()
        .... ' process this row
    End While