Click to See Complete Forum and Search --> : 2 questios about array:
pelegk1
07-31-2003, 02:35 AM
i need to make a simple array n the server side in vbscript code!
i dont know that array size in advance!
i need 2 things 2 know :
1)
how do i create an array 9i mean how to define it)!
like :
dim arr1 as Array() ??
2)
i need to check be fore i create the array if its not already was created how can i do that?
thanks inadvance
PEleg
pelegk1
07-31-2003, 02:47 AM
Dim userPriviligesArr
userPriviligesArr=Array(0..100)
DO while not rsPriviligeRes.EOF
Response.Write rsPriviligeRes("group_id")
userPriviligesArr(tmpCount)=rsPriviligeRes("group_id")
tmpCount=tmpCount+1
rsPriviligeRes.MoveNext
Loop
and if got :
Subscript out of range: '0'
what to do?
tonyt
07-31-2003, 04:45 AM
Try this:
Dim userPriviligeArr() ' Declare dynamic array
Dim lngUBound ' long variable for array counter
lngUBound = userPrivilige(userPriviligeArr,0) + 1
Do while not rsPriviligeRes.EOF
ReDim Preserve userPriviligeArr(0,lngUBound)
userPriviligesArr(tmpCount)=rsPriviligeRes("group_id")
tmpCount = tmpCount + 1
lngUBound = lngUBound + 1
rsPriviligeRes.MoveNext
Loop
pelegk1
07-31-2003, 07:18 AM
i need 2 dimensio' array
and both of the 2 dimmensions must be dinamic!
is it possible?
thnen how?
10X:)
Peleg
pelegk1
07-31-2003, 08:45 AM
i need 2 dimensio's array
and both of the 2 dimmensions must be dinamic!
is it possible?
thnen how?
10X
Peleg
pelegk1
07-31-2003, 09:16 AM
i didnt think any 1 saw the question before
and as much as i remember its the first time i posted twice!
other times it happedn it was beacuse i mistakely pressed new insted of reply