I've got an error that I simply cannot locate:
I've got a form in which I use a datareader object to read information from
a db. After the read, I close the reader and I dispose of both the reader
and the command object (but don't close the connection which is public in
the solution).
The first time i open my form from a parent form, there is no problem.
Everything works fine. I then close down my form, and I dispose of the form.
Then I open a new instance of the form using the new keyword, and then I get
the error when the command object tries to execute the datareader:
There is already an open DataReader associated with this Command which must
be closed first.
Why the heck? I'm 100% sure that the datareader is closed after use, and
I've even disposed of both the reader object, the command object and the
form itself.
What's going on?
From MSDN I can see that I'm not the first person with that problem, but I
cannot find any solution to it. There is a workaround posted (also on MSDN)
simply saying: Close your connection and reopen it. But I cannot do that,
because that connection is used elsewhere in the solution....
Any input would be appreciated,
Johnny J.