Redim arr(10)
will make your array 10 long
You're trying to make the array as long as there are records right ?
Cause I had some trouble getting the numbers of records without looping through it till EOF and then initting the array like Redim records(i - 1)
RecordsCount() method is only supported if you create the record in a special way. I had a post about it a few days back.. I never managed to get it working, or didn't bother, don't remember. Works just as well just going through the records and incrementing a counter
I never got the GetRows() method to work either. But you do seem to be addressing your arrays wrong if I'm not mistaking. it's arr(i)(j) not arr(i,j).
<quote>Now the first dimension carrys the forst row the size of the query i used
select one,two,three from numbersrange where id = 123456</quote>
can't make sence out of this. Could you explain diff. please
What do you mean by 4 rows of the same id ? you put every row into a different array element like as if you'ld do something like arr(0) = otherarray("a","b"
With
for i=0 to UBound(arr)
Response.Write "<BR> element 1"&arr(i,1)
next
you get only the 1st element so what you need to do is get the length of the array inside the 1st dimension of the array.
for i = 0 to Ubound(arr)
for j = 0 to Ubound(arr(i))
Response.Write "<BR> element " & j & " from array " & i & " : " &arr(i,j)
next
next
set rs = connTemp.Execute(sql)
arr = rs.GetRows()
'ReDim Preserve OrderArray(50,rs.RecordCount())
%><table ID="Table1"><tr><%
for i=0 to UBound(arr)
'Response.Write "<BR> element 0"&arr(i,0)
%><td><%
for j=0 to UBound(arr)
Response.Write "<BR> element 1"&arr(i,j)
next
%></td><td><%
next
%></td></tr></table><%
'testing start
Wrong way round, the second number relates to the rows (records) in the array, the first number is the elements (fields) in each row. This how .getrows populates an array
Hi 100dtl,
As correctly suggested by GaryC123,the you refer to an array, which gets it data after Getrows() method , in the form of Arr(numcol,numrow) where numcol is the nth column and numrow is the nth row.Hope it is clear till now.
Now here is how you get the data from the database :-
Set rs = conn.Execute(sql)
alldata = rs.Getrows() 'alldata is the name of the array
numcols=ubound(alldata,1)
numrows=ubound(alldata,2)
' now you can close the connection to the database,if you want
Thats it!!!
If you have any further queries feel free to post it
Regards
Itron
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.