troubleshooting Question

add to multidimensional array

Avatar of dcass
dcassFlag for United States of America asked on
ASPVB ScriptMicrosoft SQL Server
5 Comments1 Solution477 ViewsLast Modified:
I need to add one array to another (or add them both to a new one, but MSDN says redim is not needed but I get an error when I try to add to the next available index.
I tried dim and redim - still error - subscript out of range on arrResultsx(x,ctrx).  I also tried without the internal x loop.
SQL = "SELECT * FROM T1News where ..."
      SQL_Rs.open SQL,SQL_Cn,3
       	IF NOT(SQL_Rs.EOF) THEN
			arrResultsx = SQL_Rs.getrows
		    ctrx = ubound(arrResultsx,2)
		END IF
      	SQL_Rs.close
ctrx2=0
      SQL = "SELECT * FROM T1News where ..."
      SQL_Rs.open SQL,SQL_Cn,3
       	IF NOT(SQL_Rs.EOF) THEN
			arrResultsx2 = SQL_Rs.getrows
		    ctrx2 = ubound(arrResultsx2,2)
		END IF
      	SQL_Rs.close
      	
    ctrx = ctrx + 1
'    ctr = ctrx+ctrx2
'    ReDim arrResultsx(ctr)
'    %><%=arrResultsx(x,ctr)%><Br><%
    if ctrx2 > 0 then      ' if anything in 2nd array, then proceed
      for i = 0 to ctrx2
        for x = 0 to 30
'          redim preserve arrResultsx(x,ctrx)
          arrResultsx(x,ctrx) = arrResultsx2(x,i) ' also tried arrResultsx(ctrx)=arrResultsx2(i)
          ctrx = ctrx + 1
        next
      next
    end if

Open in new window

ASKER CERTIFIED SOLUTION
dcass

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros