opening and closing recordset

Results 1 to 2 of 2

Thread: opening and closing recordset

  1. #1
    Join Date
    Dec 1969

    Default opening and closing recordset

    Hello, i need help on this matter.<BR>I have an asp page which connects to same database twice which each time connects with different query, and the results outputted in different table but still in the same html. <BR>Which is best optimized method should i use when connecting to the same database twice in a page, should i use do it this way :<BR><BR>connection open<BR>recordset open<BR>running query I<BR>getrows<BR>connection close<BR>recordset close<BR>..some html codes..<BR>connection open again<BR>recordset open again<BR>running query II<BR>getrows<BR>connection close again<BR>recordset close again<BR>..some html codes..<BR><BR>or should i use this way instead :<BR><BR>connection open<BR>recordset open<BR>running query I<BR>getrows<BR>..html..<BR>running query II<BR>getrows<BR>..html..<BR>connection close<BR>recordset close<BR><BR>or do i made a big mistake here and there&#039;s should be other way ?<BR><BR>The difference between those method above is that the first method open and closes twice compared to second method which open and close only 1 time. Which method is the best and the fastest way ?<BR>Any help is appreciated.<BR>Thanks.

  2. #2
    Join Date
    Dec 1969

    Default RE: opening and closing recordset

    Always use 1 connection per page.<BR>Faster & more efficient.<BR><BR>presume objConn is your defined connection<BR><BR>sql1 (1st query)<BR>set rs = objConn.Execute(sql1)<BR>rs.close<BR><BR>sql2 (1st query)<BR>set rs = objConn.Execute(sql2)<BR>rs.close<BR><BR>sql3 (1st query)<BR>set rs = objConn.Execute(sql3)<BR>rs.close<BR><BR>objConn.c lose<BR><BR>

Posting Permissions

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