2D Array in Classic ASP

How to create a 2D Array in Classic ASP?

Thanks

Posted by:

Comments History


by: on
its easier then you think. Think of Ms Excel when creating a 2D array. Dim MyArray(1,2) That means my Array will contain ... 1 = Columns 2 = Rows But remember Array index starts with "Zero/0". so it contains 2 Columns & 3 Rows. And this is how you can populate them... MyArray(0,0) = "I am Column 0 & Row 0" MyArray(1,0) = "I am Column 1 & Row 0" So we created a Row above with 2 Columns. by changing the index you can move on to next row and columns. 2D Array could be used in Asp classic as well as Asp.net, I use them all the time. you can store data into them and then Loop through them over & over within your page lifecycle. This is how you Loop. For i = 0 to ubound(MyArray, 2) Response.write MyArray(1, 0) Next Above will Loop through a 2D array and will print a 2nd column of First Row into the Page. Happy Programming. Saqib A. khan
 
by: on
I've source code of a shopping cart in classic ASP using nothing but 2D Array (No Database involved). Let me know if you need source code. Thanks
 
by: on
Hi Saqib, can you share the source code for my personal development Thank You, Regards, Ravi Kumar Email: sesettyravikumar@gmail.com
 
by: on
You mean you want to see Shopping Cart Code? Thanks
 
by: on
ok so looping through the numeric array is great, however, does anybody know how to loop through an associative array?
 
by: on
Asp does not really have pure support for associative array. However there is trick that you can use... CONST AGE = 0 CONST SEX = 1 Redim myArray(1) myArray(AGE) = "27" myArray(SEX) = "M" So you can Constants combined with array to make your own associative array. Good Luck. - Saqib Websolutions Usa Group
 
by: on
Hi Saqib, can you share the source code for ASP shopping cart development Thank You, Regards, aaryan share at: pandit.aaryan@gmail.com
 
by: on
Should I post here with instructions... or you prefer Email? - Saqib
 
by: on
Please post here
 

Name :  

Email :  

Comment Below