The HasRows property raises an exception when called on an empty reader...
Code: Select all
SalesforceCommand cmd = new SalesforceCommand("SELECT ID FROM LENSES", sf.Connection);
cmd.Prepare();
SalesforceDataReader reader = cmd.ExecuteReader();
if (reader.HasRows)
Type: NullReferenceException
Message: Object reference not set to an instance of an object.
Another question... Should we close the reader once we are done with it... in the sample code of the HasRows property the reader is not closed... Right now I have the same exception raised when I try to close the reader if the reader has no rows.
Thanks