Not used to ASP

S

Sonnich Jensen

Hi all!

I am usually working with PHP, rarely with ASP. I have a book for
help, but that does not do much for me.

I have an array, like:

redim Preserve ecode(I+1)
ecode(I) = field_value(0, rsItem)

it adds stuff to the array.

Now, I need to _insert_ items into the array.
In other words, I need to find an item, say "code C" in the array, and
then insert "code C-1" right after it.

I know very well how to do this in PHP, but I dont even know where to
look for help for ASP.

Would anyone be so kind to help me out?

BR
Sonnich
 
B

Bob Barrows [MVP]

Sonnich said:
Hi all!

I am usually working with PHP, rarely with ASP. I have a book for
help, but that does not do much for me.

I have an array, like:

redim Preserve ecode(I+1)
ecode(I) = field_value(0, rsItem)

it adds stuff to the array.

Now, I need to _insert_ items into the array.
In other words, I need to find an item, say "code C" in the array, and
then insert "code C-1" right after it.

I know very well how to do this in PHP, but I dont even know where to
look for help for ASP.

Would anyone be so kind to help me out?
First of all, the language you are using is vbscript, not ASP. ASP is a
"platform" which supports multiple scripting languages, including
vbscript and jscript.
You can download the Windows Scripting Host (which includes vbscript)
documentation from here:
http://www.microsoft.com/downloads/...48-207d-4be1-8a76-1c4099d7bbb9&DisplayLang=en
Vbscript does not support inserting elements into the middle of an
array.
If you are tied to using a vbscript array, you have two options:
1. Create a new array and write the array elements in the order you want
them
2. Resize the array, use a loop to move the array element values to the
desired location and set the desired element value to the value you wish
to insert.

This task is a little simpler with an ad hoc ADO recordset: AddNew still
adds records to the end of the recordset, but you can use Sort to order
them in any order you want.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,273
Latest member
DamonShoem

Latest Threads

Top