Using a var in 2D-array 
Author Message
 Using a var in 2D-array

Hi, I''ve made an array with 2 dimensions.
clientFields(1,1) = ...
clientFields(1,2) = ...
clientFields(2,1) = ...
...

When I try to list the values from the array in a for-loop, I can''t use a variable in arrayname:

For i = 1 to 10
Response.Write(objClient(clientFields(i,2)))
Next

(objClient is a recordSet)

If I write a 1 instead the i, it works fine but that''s not really wht I''m looki



Fri, 01 Jul 2005 03:06:34 GMT  
 Using a var in 2D-array
Koen,
What do you mean you can't?  Do you get an error?

The following works fine for me:

dim a(12, 12)

' fill the array
for i = 0 to 12
 for j = 0 to 12
  a(i, j) = i*j
 next
next

for i = 0 to 12
 for j = 0 to 12
  response.write i & " * " & j & " = " & a(i, j)
 next
next

You may want to check that you have an actual value in that element of the
array...

--
Please respond in the newsgroup so everyone may benefit.
 http://dev.remotenetworktechnology.com
 ----------
 Subscribe to Microsoft's Security Bulletins:
 http://www.microsoft.com/technet/security/bulletin/notify.asp


Quote:
> Hi, I''ve made an array with 2 dimensions.
> clientFields(1,1) = ...
> clientFields(1,2) = ...
> clientFields(2,1) = ...
> ...

> When I try to list the values from the array in a for-loop, I can''t use a

variable in arrayname:
Quote:

> For i = 1 to 10
> Response.Write(objClient(clientFields(i,2)))
> Next

> (objClient is a recordSet)

> If I write a 1 instead the i, it works fine but that''s not really wht I''m

looki


Fri, 01 Jul 2005 03:25:01 GMT  
 Using a var in 2D-array

You were right.

Not all elements from the array were filled in correctly so ASP couldn't
find the value in the recordset. Stupid me!

Thanks for fast reply!
Kay

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Fri, 01 Jul 2005 03:39:25 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. wsh/ jscript : BUG : array of array, 2D array

2. recordset into 2d array using getrows()

3. Array of Arrays and 2D array

4. Array Filter Function and 2D Array

5. 2D Array to 1D Array

6. Convert 2d array to 1d array

7. Using a array as a session var (ASP) ?

8. var = var = var

9. var = var = var

10. passing 2D array

11. dynamic 2d arrays

12. passing 2D array

 

 
Powered by phpBB® Forum Software