Só que acontece o seguinte... o primeiro vetor do array fica em branco, myArray(0,x), e gostaria de preencher esse falor com os dados do usuário reg=1 (utilizado para iniciar a busca no bando de dados)... Porém, quanto eu atribuo os dados (linha em negrito)... os demais dados do array somem... alguém pode me orientar onde estou errando?
Agradeço desde já
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
Response.Buffer = False
Dim myArray()
ReDim myArray(0,4)
Public Function Acres()
Dim Qtd, Tmp()
Qtd = Ubound(myArray,1)
ReDim Tmp(Qtd, 4)
For i = 0 To Qtd
Tmp(i,0) = myArray(i,0)
Tmp(i,1) = myArray(i,1)
Tmp(i,2) = myArray(i,2)
Tmp(i,3) = myArray(i,3)
Next
ReDim myArray(Qtd+1,4)
For i = 0 To Ubound(Tmp,1)
myArray(i,0) = Tmp(i,0)
myArray(i,1) = Tmp(i,1)
myArray(i,2) = Tmp(i,2)
myArray(i,3) = Tmp(i,3)
Next
Acres = Qtd+1
End Function
Sub MontaLista(varLM, varNivel)
Dim objRs, varTotal
Set objRs = objCon.Execute("select idAss, Associate from tblAssociados where line_manager='" & varLM & "' And ativo <> 2")
If Not objRs.Eof Then
Do Until objRs.Eof
varTotal = Acres
myArray(varTotal,0) = objRs("idAss")
myArray(varTotal,1) = objRs("associate")
myArray(varTotal,2) = varLM
myArray(varTotal,3) = varNivel
MontaLista objRs("associate"),varNivel+1
objRs.MoveNext
Loop
End If
objRs.Close
Set objRs = Nothing
End Sub
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Montagem de Árvore</title>
</head>
<body>
<%
Set objCon = Server.CreateObject("ADODB.Connection")
objCon.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath ("db.mdb") & ";Persist Security Info=False")
Set objRs = objCon.Execute("select id, associado, diretor from tblassociados where reg=1")
If Not objRs.Eof Then
idAssociado = objRs("id")
varNome = objRs("associate")
varGerente = objRs("diretor")
End If
objRs.Close
Set objRs = Nothing
MontaLista varNome, 1
myArray(0,0) = idAssociado
myArray(0,1) = varNome
myArray(0,2) = varGerente
myArray(0,3) = 0 'nível inicial da busca
objCon.Close
Set objCon = Nothing
Response.Write("<br /><br /><table width='100%' border='1' cellpadding='0' cellspacing='0'>")
For i = 0 To Ubound(myArray,1)
If myArray(i,0) = "" Then
Response.Write("<tr>")
Response.Write("<td colspan='4'>Em branco: Posicção " & i & "</td>")
Response.Write("</tr>")
Else
Response.Write("<tr>")
Response.Write("<td>" & myArray(i,0) & "</td>")
Response.Write("<td>" & myArray(i,1) & "</td>")
Response.Write("<td>" & myArray(i,2) & "</td>")
Response.Write("<td>" & myArray(i,3) & "</td>")
Response.Write("</tr>")
End If
Next
Response.Write("</table>")
%>
</body>
</html>










