Issue with SafeDataReader

Issue with SafeDataReader

Old forum URL: forums.lhotka.net/forums/t/4076.aspx


meierk posted on Friday, December 21, 2007

I have a stored procedure that returns 4 result sets to my SafeDataReader in my root class.  The root class loads its data, calls dr.NextResult() and then passes the reader to a child class to load its data which in turns repeats the process for its 2 children.

The problem that I am having is that the first grandchild iterates past the end of the result set:

i.e. while(dr.Read())
                this.Add(BendReading.GetBendReading(dr));

I have testing this my proc and it only returns 4 rows for this particular result, but BendReading.GetBendReading(dr) is being called a 5th time.  Am I doing something wrong or is there a know issue with the SafeDataReader?

Kevin

JoeFallon1 replied on Friday, December 21, 2007

You can't load grandchildren that way. There is nothing wrong with the datareader.

See my comments in model design thread you started.

Joe

 

Copyright (c) Marimer LLC