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

From: Mich (mich_at_nomail)
Date: 10/31/04


Date: Sun, 31 Oct 2004 08:56:21 +0100

Thanks, but suppose i also need the records, how can i then use GetRows()?

Thanks again
Mich

"Mark J. McGinty" <mmcginty@spamfromyou.com> wrote in message
news:OAVmglqvEHA.1992@TK2MSFTNGP15.phx.gbl...
> 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
> >
> >
>
>