G
Guest
Using .net 2 and Sql Server 2005, I am intermittently getting the exception:
Invalid attempt to FieldCount when reader is closed.
What I don't understand is how the DataReader could be closed when it was
just created by ExecuteReader.
As in:
dr = cmd.ExecuteReader() ;
Console.Write ( dr.FieldCount ) ;
If there's a problem (like the connection is closed) then why doesn't
ExecuteReader throw an exception? (For that matter, why doesn't
ExecuteScalar?)
Invalid attempt to FieldCount when reader is closed.
What I don't understand is how the DataReader could be closed when it was
just created by ExecuteReader.
As in:
dr = cmd.ExecuteReader() ;
Console.Write ( dr.FieldCount ) ;
If there's a problem (like the connection is closed) then why doesn't
ExecuteReader throw an exception? (For that matter, why doesn't
ExecuteScalar?)