2 ways to open a recordset

Results 1 to 2 of 2

Thread: 2 ways to open a recordset

  1. #1
    Join Date
    Dec 1969

    Default 2 ways to open a recordset

    Hi there.<BR><BR>I&#039;m wondering, which is the faster/better way to open a recordset. <BR><BR>nr 1:<BR>set objRS = Server.createObject("ADODB.Recordset")<BR>with objRS<BR> .ActiveConnection = objConn<BR> .CursorType = adOpenDynamic<BR> .Source = strSQL<BR> .open<BR>end with<BR><BR>or <BR><BR>nr 2:<BR>set objRS = Server.createObject("ADODB.Recordset")<BR>objRS.op en strSQL, objConn, adOpenDynamic<BR><BR>I must say that I really like the with statement, it&#039;s elegant. But I don&#039;t know which one is better.<BR><BR>Which one should I use and why?

  2. #2
    Join Date
    Dec 1969

    Default It is elegent...

    But it&#039;s very, very slow in VBS.<BR><BR>There was an article on 4Guys a few months ago that ran a performance test on several equivelent methods in VBS, and With was one of them, and it ran, far, far slower than the other two methods....So, I&#039;d say go for number two.

Posting Permissions

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