I'm not sure what your problem is; But I'd like to comment on your approach
to database connection management. I'd suggest not opening a connection early
and closing it late as it seems you're doing in the page. I'd suggest instead
opening it late and closing it early. IOW, open the connection right when
you need it, use it (get your data, update, whatever), then close it right
there and then (in your Page_Load or Button_Click or whereever). Connections
are pooled so in a miltiuser environment like ASP.NET you'll have good chances
of reusing open connections that have been put back into the pool.
Also, it helps to make sure that you never have any idle connections. If
you open the connection in Page_Load, say, and close it in Unload... well,
there are cycles where the connection is doing nothing, but it's allocated
and owned by your page an unusable to anyone else. So putting it back in
the pool ASAP let others use it and you end up using fewer connections at
the same time.
Lastly, opening late and closing early makes for less buggy code and less
chances for a leak of the connection.
-Brock
DevelopMentor
http://staff.develop.com/ballen Hi,
I'm overriding OnUload in my pages. I've put the Connection.Close in
the
method.
But I have noticed that the method is run twice if I do a
Response.Redirect
in the page.
Do some one know why?
cheers,
mortb