I have a program that uses a DB2 stored procedure called from a C# batch job. Once the .ExecuteReader() call has been made, Visual Studio 2010 shows that the FieldCount for the data reader object is '0' and the HasRows property is 'False.'
However.. upon further inspection I come to find that hidden deep within the object (this was discovered by sifting through the 'Locals' readout while debugging), the stored procedure is in fact sending data back and the information I need is burried deep within the DB2DataReader object.
Since both the HasRows and FieldCount properties are 'False' and '0', respectively, I cannot get to the data using any of it's built-in methods (i.e. .GetString(x), .GetValue(x).ToString(), etc). I cannot loop through the results because a while(reader.Read()) command will always be false (due to the HasRows property).
Has anyone experienced problems like this using any sort of DataReader, or have any suggestions in general?
As it turned out, the DB2 DataReader was not the best object to use. Instead we simply called an ExecuteNonQuery() command on the DB2Connection object (in C#) as were able to pull the data out using this method.