G
Guest
Hi all,
I am stuck with this problem.
the code is like this:
Dim sqlreader As SqlDataReader =
myCommand.ExecuteReader(CommandBehavior.CloseConnection)
sqlreader.GetValue(sqlreader.GetOrdinal(columnname) give me the following in
the watch window:
sqlreader.GetValue(sqlreader.GetOrdinal("enrolldate")) Run-time exception
thrown : System.InvalidOperationException - Invalid attempt to read when no
data is present.
But I can get the column number: sqlreader.GetOrdinal("enrolldate") is 1.
What's going on?
Thank you.
Betty
I am stuck with this problem.
the code is like this:
Dim sqlreader As SqlDataReader =
myCommand.ExecuteReader(CommandBehavior.CloseConnection)
sqlreader.GetValue(sqlreader.GetOrdinal(columnname) give me the following in
the watch window:
sqlreader.GetValue(sqlreader.GetOrdinal("enrolldate")) Run-time exception
thrown : System.InvalidOperationException - Invalid attempt to read when no
data is present.
But I can get the column number: sqlreader.GetOrdinal("enrolldate") is 1.
What's going on?
Thank you.
Betty