A
Andrei Pociu
In a typical ASP .NET Web Application (website), I'm currently using a class
where I declare some public static objects. For example there's the place
where I initialize the SqlConnection.
Also there's the place where I declare one public static DataReader, but I'm
not sure this is the best way to do it. I use that DataReader in all the
webforms and user controls, whenever I have to read data from the db.
So, should I do it this way or should I create a new DataReader each time I
need it?
By the way, I started to ask myself this questions since I'm experiencing
different problems with using a public DataReader, like for example "There
is already an open DataReader associated with this Connection which must be
closed first" errors, even if I'm closing all of them.
Thanks for your support.
where I declare some public static objects. For example there's the place
where I initialize the SqlConnection.
Also there's the place where I declare one public static DataReader, but I'm
not sure this is the best way to do it. I use that DataReader in all the
webforms and user controls, whenever I have to read data from the db.
So, should I do it this way or should I create a new DataReader each time I
need it?
By the way, I started to ask myself this questions since I'm experiencing
different problems with using a public DataReader, like for example "There
is already an open DataReader associated with this Connection which must be
closed first" errors, even if I'm closing all of them.
Thanks for your support.