Re: classic asp: "This array is fixed or temporarily locked "

Re: classic asp: "This array is fixed or temporarily locked "

am 05.02.2007 17:31:00 von reb01501

Eric Layman wrote:
> Hi,
>
> I have the following script below.
>
> I intend to have a dynamic array of non fixed size
>
> set rsseats = conn.execute("select * from seats")

http://www.aspfaq.com/show.asp?id=2096

> Dim arr(1)
> response.write ubound(arr)
> do while not rsseats.eof
> ReDim arr(ubound(arr)+1)
> rsseats.movenext
> loop
> set rsseats = nothing
>
> But i will get hit with "The array is fixed or temp locked"
>
> how should i fix that
>
Actually, you are going to too much trouble. Use GetRows to create an
array from your recordset:

if not rsseats.eof then arr=rsseats.getrows

This will create a 2-dimensional array of the recordset data: the first
dimension refers to the field and the second to the row. So to look at
the second field of the third row, you would do this:

arr(1,2)

You can specify which field to extract if you only want to extract a
single field (however, in this case, why retrieve ALL the fields when
only interested on one?)

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.

classic asp: "This array is fixed or temporarily locked "

am 06.02.2007 01:31:48 von Eric Layman

Hi,

I have the following script below.

I intend to have a dynamic array of non fixed size

set rsseats = conn.execute("select * from seats")
Dim arr(1)
response.write ubound(arr)
do while not rsseats.eof
ReDim arr(ubound(arr)+1)
rsseats.movenext
loop
set rsseats = nothing

But i will get hit with "The array is fixed or temp locked"

how should i fix that

Please advise.

Thanks



Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com

Re: classic asp: "This array is fixed or temporarily locked "

am 06.02.2007 01:31:48 von Eric Layman

"Eric Layman" wrote in message
news:1170686110_8733@sp6iad.superfeed.net...
>
> Hi,
>
> I have the following script below.
>
> I intend to have a dynamic array of non fixed size
>
> set rsseats = conn.execute("select * from seats")
> Dim arr(1)
> response.write ubound(arr)
> do while not rsseats.eof
> ReDim arr(ubound(arr)+1)
> rsseats.movenext
> loop
> set rsseats = nothing
>
> But i will get hit with "The array is fixed or temp locked"
>
> how should i fix that
>
> Please advise.
>
> Thanks
>
>
> Posted Via Usenet.com Premium Usenet Newsgroup Services
> ----------------------------------------------------------
> ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
> ----------------------------------------------------------
> http://www.usenet.com

I've got it.

set rsseats = conn.execute("select * from seats")
Dim arr()
intsize = 0
do while not rsseats.eof
ReDim preserve arr(intsize)
arr(intsize) ="my data"
intsize = intsize + 1
rsseats.movenext
loop
set rsseats = nothing

Thanks.



Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com