Re: how to use GetRows() with VBscrip (ASP)?
From: Mark J. McGinty (mmcginty_at_spamfromyou.com)
Date: 10/30/04
- Next message: Michael D. Long: "Re: MDAC 2.8 vs MDAC 2.7"
- Previous message: Mich: "how to use GetRows() with VBscrip (ASP)?"
- In reply to: Mich: "how to use GetRows() with VBscrip (ASP)?"
- Next in thread: Mich: "Re: how to use GetRows() with VBscrip (ASP)?"
- Reply: Mich: "Re: how to use GetRows() with VBscrip (ASP)?"
- Messages sorted by: [ date ] [ thread ]
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
>
>
- Next message: Michael D. Long: "Re: MDAC 2.8 vs MDAC 2.7"
- Previous message: Mich: "how to use GetRows() with VBscrip (ASP)?"
- In reply to: Mich: "how to use GetRows() with VBscrip (ASP)?"
- Next in thread: Mich: "Re: how to use GetRows() with VBscrip (ASP)?"
- Reply: Mich: "Re: how to use GetRows() with VBscrip (ASP)?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|