Problem with Data Readers and connections

G

Guest

Hi,
I am doing maintenance work for a ASP .net application which uses ADO .net
to access the data from database (SQL Server 2000).The functionality is
something like that it uses SQL Data Reader to fetch the data and always open
a new connection to do the same since only one

Data Reader at a time can work with a single connection.
The problem I am facing is that the developer hadn't closed it. so the no.
of open connections to the database increases everytime user visits the page.
One of the solution is to alter the code and close data reader whereever it
is opened and not closed.
But identifying them in the entire application is a time consuimg job and
would involve a lot of testing for it as well.

So, I felt to derive a way by which I can identify all the open data readers
and close them if there are any. This can be implemented as a scheduled job
(like GC does) which would identify the open data readers and close them at a
particular time interval.

Is there any method or way by which I can does this or suggest me If you
feel any other approach might work better than this.

Thanks in advance

Regards,
Somesh Baweja
 
M

Miha Markic [MVP C#]

I really suggest you to clean up your code instead of applying dubious
fixes...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top