...

View Full Version : Variable length arrays



tboss132
02-07-2005, 05:37 PM
Hi Guys,
I have a table in my database which have true/false values. I want to read a set of values and store them in an array if true. After i do that i'll display them on a page. The reason i want to use an array is that i want to seperate each of the values with commas and end with a full stop and with an array, i can easily do that.
No i'm not sure of the size of the array because i don't know how many values in the database have a value of true. Is there a way to have an array without knowing how many values it will contain?
Thanks.

ghell
02-07-2005, 08:06 PM
you can use UBound(arrArrayName) for the length of the array, loop until that and end with a . (LBound is the start of an array but its usually 0 unless the array is empty in which case its -1 i think)

but you seem to be quite good at asp so i doubt u are asking that :)

fractalvibes
02-07-2005, 09:49 PM
You can define it as a certain size, and if needed, expand it:
dim myarray(100)

....find out you need more:...

ReDim Preserve myarray(999)




fv

tboss132
02-08-2005, 08:22 AM
Thanks ghell and fv, i got it figured out.
The problem is I spent all my day coding and proofreading so when this problem came up at almost close of work, i couldn't get my brain to respond . (i needed to reboot :D )

but you seem to be quite good at asp so i doubt u are asking that

Good? i don't think so. I still got guys i respect eg, ghell, etc.
Thanks anyway.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum