programming-examples/asp/ActiveX_ADO_Arrays/Arrays to store data.asp

37 lines
744 B
Plaintext
Raw Normal View History

2019-11-18 14:25:58 +01:00
<html><head>
<title>arraysredim.asp</title>
</head><body bgcolor="#FFFFFF">
<%
' this code
Dim a_array(100)
' this code will fail
x=100
Dim my_array(x)
%>
</body></html>
Assigning an Array size With a variable produces an Error unless the ReDim command Is used.
<html><head>
<title>arraysredimcorrect.asp</title>
</head><body bgcolor="#FFFFFF">
<%
Dim my_array()
x=100
ReDim preserve my_array(x)
my_array(20)="Hi!"
my_array(40)="How are You"
lowcount=LBound(my_array)
highcount=UBound(my_array)
Response.Write "lowcount=" & lowcount & ";highcount=" & highcount & "<p>"
For counter=lowcount To highcount
Response.Write counter & " "
Response.Write my_array(counter) & "<br>"
Next
%>
</body></html>