Hi King,
your error indicates that the given session or an object reference is invalid.
I guess that you do not use a general form of error handling in your while loop, otherwise your application will immediately stop when an error occurs.
It's a little bit hard to make a specific statement about the source of the error, therefore it would be the best when you attach the entire project...
Thanks,
ThSa