Galera não estou conseguindo recuperar o valor de um vetor.
logo no inicio da Hp Asp eu digitei :
set busca = conn.execute("Select * from fotos where confirma = 0 and usuario = "&session("login"))
I = 0
qtd = Array()
while not busca.eof
redim preserve qtd(I)
if request.form("r"&busca("cod")) <> 1 then
conn.execute("Delete * from fotos where cod = " & busca("cod"))
end if
If Request.Form("t1-"&busca("cod")&"-"&I) <> "" Then
x = 1
qtd(I) = Request.Form("t1-"&busca("cod")&"-"&I)
If qtd(I) > 0 and qtd(I) <= 10 Then
preço = 1.00
ElseIf qtd(I) > 10 and qtd(I) <= 30 Then
preço = 0.90
ElseIf qtd(I) > 30 and qtd(I) <= 60 Then
preço = 0.85
ElseIf qtd(I) > 60 and qtd(I) <= 100 Then
preço = 0.79
ElseIf qtd(I) > 100 and qtd(I) <= 150 Then
preço = 0.75
ElseIf qtd(I) > 150 and qtd(I) <= 200 Then
preço = 0.70
ElseIf qtd(I) > 200 and qtd(I) <= 300 Then
preço = 0.68
ElseIf qtd(I) > 300 Then
preço = 0.65
End If
Else
qtd(I) = 0
preço = 0
End If
valor = FormatCurrency(Ccur(preço)*qtd(I))
busca.movenext
I = I + 1
wend
end if
e no local onde eu faço uma consulta e mostra o valor do calculo é o seguinte codigo:
<%set busca = conn.execute("Select * from fotos where confirma = 0 and usuario = "&session("login"))%>
<table width="473" border="0" cellspacing="0" cellpadding="0">
<% if not busca.eof then%>
<form name="frm" method="post">
<%
I = 0
qtd = Array()
while not busca.eof
redim preserve qtd(I) %>
<tr valign="top" bgcolor="#F8F8F8">
<td width="150" height="128" align="center"><div align="center"><img src="img.asp?a=<%=busca("usuario")%>-<%=busca("cod")%>.jpg" vspace="5"><br>
<input name="r<%=busca("cod")%>" type="checkbox" value="1" checked>
<span class="style14">Revelar</span></div></td>
<td width="190" height="128" align="left" valign="middle"><span class="style6 style4">Tamanho:</span>
<table width="185" height="32" border="0" cellpadding="0" cellspacing="0">
<tr align="left">
<td width="34" height="30"><input name="t1-<%=busca("cod")%>-<% =I %>" type="text" class="textbox"size="3" value="<% =qtd(I) %>"></td>
<td width="151" height="30"><span class="style14">
<% If x = 1 Then %>
10 x 15 -
<% =valor %>
<% else %>
10 x 15
<% end if %>
</span></td>
</tr>
<tr align="left">
<td height="30"><input name="t2-<%=busca("cod")%>-<% =I %>" type="text" class="textbox" size="3" value="<% =qtd1 %>"></td>
<td height="30"><span class="style14">
<% If y = 1 Then %>
13 x 18 -
<% =valor1 %>
<% else %>
13 x 18
<% end if %>
</span></td>
</tr>
</table></td>
<td width="133" height="128" align="left"><span class="style4 style6">Superfície:</span>
<table width="121" height="36" border="0" cellpadding="0" cellspacing="0">
<tr align="left">
<td width="26" height="16"><input name="papel<%=busca("cod")%>" type="radio" value="1"></td>
<td width="95" height="16" class="style14"> Fosca</td>
</tr>
<tr align="left">
<td height="16"><input name="papel<%=busca("cod")%>" type="radio" value="2" checked></td>
<td height="16" class="style14">Brilhante</td>
</tr>
</table>
<br>
<span class="style4 style6">Borda:</span>
<table width="121" height="32" border="0" cellpadding="0" cellspacing="0">
<tr align="left">
<td width="26" height="16"><input name="borda<%=busca("cod")%>" type="radio" value="1"></td>
<td width="95" height="16" class="style14"> Com borda </td>
</tr>
<tr align="left">
<td height="16"><input name="borda<%=busca("cod")%>" type="radio" value="0" checked></td>
<td height="16" class="style14">Sem borda </td>
</tr>
</table></td>
</tr>
<%
busca.movenext
I = I +1
wend %>
<tr>
<td height="30" valign="middle" align="center" colspan="3">
<% If x = 1 or y = 1 then %>
<span class="style6 style4">Total:
<% =FormatCurrency(total) %></span>
<% else %>
<span class="style6 style4">Digite a quantidade que deseja de cada foto.</span>
<% end if%>
</td>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="30" valign="middle" align="center" colspan="3">
<input onclick="javascript:window.location='arquivos.asp';" name="Submit" type="button" class="textbox" value="Voltar">
<input name="Submit" type="button" onClick="atualizar();" class="textbox" value="Atualizar">
<input name="Submit" type="button" onClick="confirmar();" class="textbox" value="Próximo Passo">
</td>
</tr>
</table>
oque me acontece é que, embora esteja usando um vetor, se eu tenho 2 registro para mostrar, na hora que eu digito a quantidade no de cima ele num faz o calculo e quando digito no de baixo, ele mostra o valor nos dois registros.
Pergunta
modernel
Galera não estou conseguindo recuperar o valor de um vetor.
logo no inicio da Hp Asp eu digitei :
set busca = conn.execute("Select * from fotos where confirma = 0 and usuario = "&session("login")) I = 0 qtd = Array() while not busca.eof redim preserve qtd(I) if request.form("r"&busca("cod")) <> 1 then conn.execute("Delete * from fotos where cod = " & busca("cod")) end if If Request.Form("t1-"&busca("cod")&"-"&I) <> "" Then x = 1 qtd(I) = Request.Form("t1-"&busca("cod")&"-"&I) If qtd(I) > 0 and qtd(I) <= 10 Then preço = 1.00 ElseIf qtd(I) > 10 and qtd(I) <= 30 Then preço = 0.90 ElseIf qtd(I) > 30 and qtd(I) <= 60 Then preço = 0.85 ElseIf qtd(I) > 60 and qtd(I) <= 100 Then preço = 0.79 ElseIf qtd(I) > 100 and qtd(I) <= 150 Then preço = 0.75 ElseIf qtd(I) > 150 and qtd(I) <= 200 Then preço = 0.70 ElseIf qtd(I) > 200 and qtd(I) <= 300 Then preço = 0.68 ElseIf qtd(I) > 300 Then preço = 0.65 End If Else qtd(I) = 0 preço = 0 End If valor = FormatCurrency(Ccur(preço)*qtd(I)) busca.movenext I = I + 1 wend end ife no local onde eu faço uma consulta e mostra o valor do calculo é o seguinte codigo:<%set busca = conn.execute("Select * from fotos where confirma = 0 and usuario = "&session("login"))%> <table width="473" border="0" cellspacing="0" cellpadding="0"> <% if not busca.eof then%> <form name="frm" method="post"> <% I = 0 qtd = Array() while not busca.eof redim preserve qtd(I) %> <tr valign="top" bgcolor="#F8F8F8"> <td width="150" height="128" align="center"><div align="center"><img src="img.asp?a=<%=busca("usuario")%>-<%=busca("cod")%>.jpg" vspace="5"><br> <input name="r<%=busca("cod")%>" type="checkbox" value="1" checked> <span class="style14">Revelar</span></div></td> <td width="190" height="128" align="left" valign="middle"><span class="style6 style4">Tamanho:</span> <table width="185" height="32" border="0" cellpadding="0" cellspacing="0"> <tr align="left"> <td width="34" height="30"><input name="t1-<%=busca("cod")%>-<% =I %>" type="text" class="textbox"size="3" value="<% =qtd(I) %>"></td> <td width="151" height="30"><span class="style14"> <% If x = 1 Then %> 10 x 15 - <% =valor %> <% else %> 10 x 15 <% end if %> </span></td> </tr> <tr align="left"> <td height="30"><input name="t2-<%=busca("cod")%>-<% =I %>" type="text" class="textbox" size="3" value="<% =qtd1 %>"></td> <td height="30"><span class="style14"> <% If y = 1 Then %> 13 x 18 - <% =valor1 %> <% else %> 13 x 18 <% end if %> </span></td> </tr> </table></td> <td width="133" height="128" align="left"><span class="style4 style6">Superfície:</span> <table width="121" height="36" border="0" cellpadding="0" cellspacing="0"> <tr align="left"> <td width="26" height="16"><input name="papel<%=busca("cod")%>" type="radio" value="1"></td> <td width="95" height="16" class="style14"> Fosca</td> </tr> <tr align="left"> <td height="16"><input name="papel<%=busca("cod")%>" type="radio" value="2" checked></td> <td height="16" class="style14">Brilhante</td> </tr> </table> <br> <span class="style4 style6">Borda:</span> <table width="121" height="32" border="0" cellpadding="0" cellspacing="0"> <tr align="left"> <td width="26" height="16"><input name="borda<%=busca("cod")%>" type="radio" value="1"></td> <td width="95" height="16" class="style14"> Com borda </td> </tr> <tr align="left"> <td height="16"><input name="borda<%=busca("cod")%>" type="radio" value="0" checked></td> <td height="16" class="style14">Sem borda </td> </tr> </table></td> </tr> <% busca.movenext I = I +1 wend %> <tr> <td height="30" valign="middle" align="center" colspan="3"> <% If x = 1 or y = 1 then %> <span class="style6 style4">Total: <% =FormatCurrency(total) %></span> <% else %> <span class="style6 style4">Digite a quantidade que deseja de cada foto.</span> <% end if%> </td> </tr> </table> <table border="0" cellpadding="0" cellspacing="0"> <tr> <td height="30" valign="middle" align="center" colspan="3"> <input onclick="javascript:window.location='arquivos.asp';" name="Submit" type="button" class="textbox" value="Voltar"> <input name="Submit" type="button" onClick="atualizar();" class="textbox" value="Atualizar"> <input name="Submit" type="button" onClick="confirmar();" class="textbox" value="Próximo Passo"> </td> </tr> </table>oque me acontece é que, embora esteja usando um vetor, se eu tenho 2 registro para mostrar, na hora que eu digito a quantidade no de cima ele num faz o calculo e quando digito no de baixo, ele mostra o valor nos dois registros.
Poderiam me ajudar ??
Link para o comentário
Compartilhar em outros sites
2 respostass a esta questão
Posts Recomendados
Participe da discussão
Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.