473,406 Members | 2,439 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Adding to ASP arrays

347 100+
I am trying to add a function to our site to add things to an array so i can recall them in a page and email them to another person.

I can set up the array but can figure out how to add a variable to the array wh n i click a button, the variable will always be a number.

I hope someone can help im sure i need to give more information, but not sure what is needed

Thanks
Jan 21 '09 #1
5 1845
stepterr
157 100+
It's been a long time since I've done this but sounds like you may need to use a ReDim Preserve.
Jan 22 '09 #2
jhardman
3,406 Expert 2GB
The easiest way I know of to add to an array in ASP is to keep the array in a long delimited string until you need to use it as an array. That way, you just convert it to an array at the last minute with a split() function like the following:
Expand|Select|Wrap|Line Numbers
  1. dim myArrayString, myArray
  2. myArrayString = "term1,term2,term3"
  3. myArrayString = myArrayString + ",term4"
  4. myArray = split(myArrayString, ",")
let me know if this helps.

Jared
Jan 22 '09 #3
colinod
347 100+
i know this but how can i run the code line

Expand|Select|Wrap|Line Numbers
  1. myArrayString = myArrayString + ",term4"
on the click of a button
Feb 5 '09 #4
colinod
347 100+
ive now got this working, using a combination of javascript and asp.....

can anyone tell me if this is possible

i have an asp variable that contains variables that are delimeted with a comma

i.e 123,123,234,3454,56,67,89

these numbers relate to items in my database

can i do an sql query on the database or just select the items that relate from a general query
Feb 6 '09 #5
jhardman
3,406 Expert 2GB
@colinod
On the click of a button it would be easiest with javascript:
Expand|Select|Wrap|Line Numbers
  1. <button onClick="AddMyString('term4')">
  2. ...
  3. <javascript>
  4. function AddMyString(term)
  5. {
  6. myArrayString += term;
  7. }
  8. </javascript>
Something like that, my javascript usually needs quite a bit of tweaking to work, I don't really consider myself an expert, but something like this should work.

Jared
Feb 9 '09 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: David | last post by:
I have an array that contains numbers in string elements , i want to convert this to integers, i have made a for loop that uses the number of elements in the array and then adds 0, thereby...
0
by: Björn | last post by:
Hello, Starting to code a robust routine to add two arrays element by element $new = $a + $b ... I thought that this should already be done and searched CPAN for a sutiable module. Despite...
6
by: Jamie Fryatt | last post by:
Hi everyone, here's what id like to do. I have a table with 2 fields, name and value I need to be able to add multiple records quickly, for example I need to add name value abc 1...
34
by: Adam Hartshorne | last post by:
Hi All, I have the following problem, and I would be extremely grateful if somebody would be kind enough to suggest an efficient solution to it. I create an instance of a Class A, and...
23
by: Rick | last post by:
Hi, This is probably simple byt when you never did pointers and being used to luxery strings like in Delphi or Visual Basic, C can get though. What I'm trying to do is to add chars to a string....
5
by: Troy | last post by:
Hello, I have a dumb question. I have two array objects of type double with 12 elements in each object. I'd like to add the two objects but dont know how to. Any ideas? thanks
6
by: Maheshkumar.R | last post by:
How i can store images in array @ runtime..? What are the possbile ways.. Thankz.. - Mähésh Kumär. R
1
by: mtchatchez | last post by:
I have several 2-dimensional arrays which I want to sum the values of, returning an array that has for each of its values the sum from all the others (if that makes sense?) ... Okay ... maybe an...
11
by: dennis.sprengers | last post by:
Consider the following multi-dimensional array: --------------------------- $arr = array( array(3, 5, 7, 9), array(2, 4, 6, 8), array(1, 3, 5, 7) ); function add_arrays($arr) { for ($row =...
6
by: santiago | last post by:
I guess one cannot do this: arraytot = arraytot + arraydet; So, what's the trick to adding arrays like this? Thanks.
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.