I think you might be right.
I don't use DataReaders much. I'm far more of a DataAdapters kind of guy.
But HasRows doesn't do any reading. Read does the reading...
Read = Cmd.ExecuteReader
If Read.HasRows Then
Do While Read.Read
HasRows doesn't tell it when it is at the end of the resultset, just that it contains some rows, so your While HasRows is making it read after the end of the resultset, hence the error you are seeing. I think.
There are no computers in heaven!
Last edited by DrPunk; 07-30-2012 at 10:12 AM.