Results 1 to 33 of 33

Thread: All worked fine yesterday..sqldatareader yet again

Hybrid View

  1. #1
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: All worked fine yesterday..sqldatareader yet again

    Perhaps what is going on is the DataReader is being closed because you are closing the DB connection associated with it?

    That is the only thing that seems to make any sense. You are closing the connection to the database, which the DR needs, so the DR closes as well??

    That is just a guess, but it seems to make sense... set a watch on your lRead.IsClosed property when you are in your UseSQLDBExecuteReader, and see if it changes from open to closed as your finally runs. Also even if you remove the finally, the connection is going out of scope when your function ends, which would explain why even if you remove the finally it still happens?

  2. #2

    Thread Starter
    Banned
    Join Date
    May 2006
    Posts
    161

    Re: All worked fine yesterday..sqldatareader yet again

    Quote Originally Posted by kleinma
    Perhaps what is going on is the DataReader is being closed because you are closing the DB connection associated with it?

    That is the only thing that seems to make any sense. You are closing the connection to the database, which the DR needs, so the DR closes as well??

    That is just a guess, but it seems to make sense... set a watch on your lRead.IsClosed property when you are in your UseSQLDBExecuteReader, and see if it changes from open to closed as your finally runs. Also even if you remove the finally, the connection is going out of scope when your function ends, which would explain why even if you remove the finally it still happens?
    Why would it work then if I move the debugger doesnt it still lose the scope since the function ends?
    That doesnt make any sense its valid when I move the debugger to the "end try" line of the finally statement without hitting the actual dispose and close methods...yet if I even comment them out and run the same code..it fails?

    How would you go around returing lRead then ? I do not want to maintain a connection to the db as this reduces the performance of this entire class...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width