S
Scott M.
I am familiar with DataReaders, but I am experiencing behavior I haven't
seen before.
I am using:
Dim dr as SQLClient.SQLClientDataReader
dr = command.ExecuteReader(CommandBehavior.SingleRow)
....and I am sure that the DataReader is returning 1 record (as it should).
What is troubling is that when I set watches on:
dr.Read()
dr.Item("x")
dr.Item("y")
I see that dr.Read() becomes True immedately after the command.ExecuteReader
statement (so far, so good). Now, my understanding is that "True" means
there is at least one more record to advance to, but at this point (not
having called dr.Read yet) I'm not actually on the first record yet.
What's strange is that at this point (again all I've done is
"ExecuteReader", didn't call dr.Read yet), the watches I have set up for
particular dr.Item values show up with the correct values! If it's true
that I am not on the first record yet, then why would I get these values at
this point.
Here's the next strange thing, after executing the next line of code after
"ExecuteReader", no matter what that line is, causes the dr.Read value to
become false and the dr.Item values to be thrown out!
seen before.
I am using:
Dim dr as SQLClient.SQLClientDataReader
dr = command.ExecuteReader(CommandBehavior.SingleRow)
....and I am sure that the DataReader is returning 1 record (as it should).
What is troubling is that when I set watches on:
dr.Read()
dr.Item("x")
dr.Item("y")
I see that dr.Read() becomes True immedately after the command.ExecuteReader
statement (so far, so good). Now, my understanding is that "True" means
there is at least one more record to advance to, but at this point (not
having called dr.Read yet) I'm not actually on the first record yet.
What's strange is that at this point (again all I've done is
"ExecuteReader", didn't call dr.Read yet), the watches I have set up for
particular dr.Item values show up with the correct values! If it's true
that I am not on the first record yet, then why would I get these values at
this point.
Here's the next strange thing, after executing the next line of code after
"ExecuteReader", no matter what that line is, causes the dr.Read value to
become false and the dr.Item values to be thrown out!