Re: how to use GetRows() with VBscrip (ASP)?

From: Mark J. McGinty (mmcginty_at_spamfromyou.com)
Date: 10/30/04


Date: Sat, 30 Oct 2004 10:57:04 -0700

If all you want is a record count you don't want to use GetRows, as it'll
incur i/o cost of reading all the data and stuffing an array with it -- not
that it isn't fairly efficient at that, it's just unnecessary.

Instead change your SQL to "SELECT COUNT(*) AS [RowCount] FROM mytable".
Since it will return exactly one row with one [derived] field that will not
be writable, it's pointless to use anything but a 'firehose' (read-only
forward-only) cursor, so:

    set rs = objdc.Execute(sql)
    rec = rs(0).value

will do in place of your last 3 lines.

-Mark

"Mich" <mich@nomail> wrote in message
news:%238KHTkpvEHA.2536@TK2MSFTNGP10.phx.gbl...
> Hi,
>
> I want to use GetRows() instead of RecordCount, but i have some problem
> with
> array in VBscript (ASP).
>
> This is what i want to change with GetRows():
> <%
> set objdc = Server.CreateObject("ADODB.Connection")
> objdc.Open("provider=Microsoft.Jet.OLEDB.4.0; Data Source =c:\mydb")
> sql="select field1 from mytable;"
> set rs=Server.CreateObject("ADODB.Recordset")
> rs.open sql, OBJDC, 3, 3
> rec=rs.RecordCount
> %>
>
> Thanks
> Mich
>
>



Relevant Pages

  • Re: Email Multiple Recipients with table
    ... GetRows returns a 2-dimensional array. ... value of zero in the first dimension of your array. ... Dim arr() As String, i As Integer, vnt As Variant ...
    (microsoft.public.access.formscoding)
  • Re: ASP ecommerce help
    ... >1) I use the getrows feature all the time now for recordsets rather than ... I always use getRowsand store all the info into an array, ... >traffic means that as there is a lot of ASP work to be done on my pages then ... Sorry never done any ecommerce. ...
    (microsoft.public.inetserver.asp.db)
  • Re: Best way to populate a <SELECT>
    ... Use .GetRows() to return an array from your recordset. ... GetRows array into a routine that writes your ...
    (microsoft.public.inetserver.asp.db)
  • Re: question about opening and closing connections on aspfaq.com
    ... if you use getrows, what do you do when you need properties: ... or use a disconnected recordset. ... containing the index numbers of the fields in the array: ... Please reply to the newsgroup. ...
    (microsoft.public.inetserver.asp.db)
  • Re: Read a table into an array
    ... I have the array the way I want it... ... > GetRows Method ... > record's Bookmark property in the Start argument. ...
    (microsoft.public.access.forms)