DataReader Error

  • Thread starter Thread starter pete
  • Start date Start date
P

pete

On my ASP page I'm getting the following error:

Invalid attempt to read when no data is present.

Description: An unhandled exception occurred during the
execution of the current web request. Please review the
stack trace for more information about the error and where
it originated in the code.

Exception Details: System.InvalidOperationException:
Invalid attempt to read when no data is present.

Source Error:


Line 98: db_rdr = db_cmd.ExecuteReader
Line 99: If db_rdr.HasRows Then
Line 100: lbl_portal.Text = db_rdr.GetString
(0)
Line 101: End If
Line 102: Else

As you can see, the reader has rows, but when I try to get
the first column, it throes an error at line 100. Any
help? This is the second time the DataReader is used in
the same routine, and the first time, it works okay.
 
Back
Top