Wednesday, March 7, 2012

Closing a connection created from a SQLDataSource

I'm new to ASP.NET and I've searched before posting.

I have a simple form containing a FormView control. The FormView uses a SQLDataSource. This works fine and in 30 seconds I have a working form without writing any code.

A form built this way causes problems with connection pooling because I am not closing the connection. What is the best method for me to remedy this?

Every resource I've found explains that I have to explicitly close the connection. How do I do that in this case? Dispose the SQLDataSource in the FormView DataBound event? Rewrite the form so I can control opening and closing of the connection?

Thanks in advance.How about disconnecting on the page.OnUnload event?

No comments:

Post a Comment