Quick Question about closing data connections

Results 1 to 3 of 3

Thread: Quick Question about closing data connections

  1. #1
    Michael Lindley Guest

    Default Quick Question about closing data connections

    I have gone through my major scripts and explicity closed all my data connections as I learned to do from one of the threads below. But now, my scripts are taking so long to run, they are often timing out. I know how to set the timeout longer, but thats not really the option I want.<BR><BR>Right now, after EVERY recordset that I open, I explicity close it as soon as I am done with it. And often times I use that same Recordset name many times in a script. So I have 20+ Recordsets that I close and reopen a lot.<BR><BR>Should I wait until the very end of the script and close them all then and let ASP handle it when I reassign the recordset by executing another SQL statement? Is that why the scripts are dragging so much?<BR><BR>Thanks for any help<BR><BR>Michael Lindley (aka Adrenaline)<BR>Co- Founder - Clan World Network<BR>*****************************<BR>Clan World Network - http://www.clannetwork.com<BR>Clan World Ladder - http://www.clanladder.com<BR>Clan World Tournament - http://www.clantourney.com<BR>Clan World League - http://www.clanleague.com

  2. #2
    Patrice Scribe Guest

    Default RE: Quick Question about closing data connections

    I don&#039t think it would made a huge difference. IMO you should check :<BR>- do you get *only* the records you need ?<BR>- do you use the proper indexes in your database ?<BR>- can&#039t retrieve data using a single SQL statement rather than using multiple ones ?<BR><BR>It seems to me more like a database issue than related to ASP handling of recordsets objects...

  3. #3
    Join Date
    Dec 1969
    Posts
    2,849

    Default RE: Quick Question about closing data connections

    If you execute many SQL queries on one page, here, in my opinion, is what you should do:<BR><BR>&#039Create database connection, open connection<BR>&#039Create recordset instance<BR><BR>&#039Open Recordset (run query)<BR>&#039Display Results<BR>&#039Close query<BR><BR>&#039Open Recordset (run query)<BR>&#039Display Results<BR>&#039Close query<BR><BR>&#039Open Recordset (run query)<BR>&#039Display Results<BR>&#039Close query<BR><BR>&#039Set recordset to nothing<BR>&#039Close connection<BR>&#039Set connection to nothing

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •