Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 3rd, 2004, 04:10 AM
Registered User
 
Join Date: Feb 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Converting recordset to an array

Hi

Trying to convert a recordset to an array, but I get a "Subscript out of range" error. Below is the code ...

<%
    'Create a recordset object instance
    Dim objRSExt
    Set objRSExt = Server.CreateObject("ADODB.Recordset")
    objRSExt.Open "SELECT * FROM FormFormats", objConn, adOpenForwardOnly

    'Write form format extensions to an array
    Dim arrExt
    arrExt = objRSExt.GetRows()

    objRSExt.Close
    Set objRSExt = Nothing
    objConn.Close
    Set objConn = Nothing

    Dim iExtLoop
    For iExtLoop = LBound(arrExt) to UBound(arrExt)
        Response.Write "<p>" & arrExt(iExtLoop) & "</p>"
    Next
%>

Any help much appreciated.
 
Old February 3rd, 2004, 05:41 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

GetRows produces a 2D array where the first dimension is the columns and the 2nd dimension is the rows, so to read, say, the 2nd column from the first row you need arrExt(1, 0).

hth
Phil





Similar Threads
Thread Thread Starter Forum Replies Last Post
Clone DAO Recordset into ADO Recordset kamrans74 VB How-To 0 March 6th, 2007 11:57 AM
Converting a String to a Byte array BrianWren Pro Visual Basic 2005 2 February 20th, 2007 11:03 PM
converting recordset to array? carnevil00 Access VBA 8 October 2nd, 2006 02:43 PM
Recordset into array foddie Beginning PHP 2 August 8th, 2006 08:36 AM
Recordset Into Array ~ How do I do it? phungleon Classic ASP Databases 2 May 13th, 2004 01:25 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.