Ir para conteúdo
Fórum Script Brasil
  • 0

Guardar Vários Valores?


Ezequiel Batista

Pergunta

ESTOU TENTANDO FAZER UMA COMPARAÇÃO COM UM CAMPO DE UM BD E GUARDAR O VALOR DE OUTRO CAMPO CASO ELE SEJA VERDADEIRO EM UMA VARIAVEL, MAS AI quando TENHO VARIOS VALORES VERDADEIROS EU NÃO CONSIGO MOSTRAR OS DOIS OU MAIS!!!

SEGUE O CODIGO ABAIXO???

<%

Dim conexao,constr,rs,soma

set conexao = createobject("AdoDb.connection")

constr = "Driver={Microsoft Access Driver (*.mdb)};DBQ="& server.MapPath("bancodedados.mdb")

conexao.open constr

set rs = conexao.execute("SELECT * FROM requisicoes order by codigo desc")

%>

<% while not rs.eof %>

<%

if rs("entregue") = "não" then if Session("pendente") = "" then Session("pendente") = rs("serventia") & Session("pendente2") "val"

if rs("entregue") = "não" then if Session("pendente2") = "" then Session("pendente2") = rs("serventia")

%>

<% if rs("entregue") = "não" then soma = soma + 1 %>

<%

rs.MoveNext

Wend

%>

<% if Session("pendente") <> "" then response.write Session("pendente") %>

<% if Session("pendente2") <> "" then response.write Session("pendente2") %>

<% response.write soma%>

</font>

</body>

</html>

EM QUE ESTOU ERRANDO??? POIS SO CONSIGO MOSTRAR DOIS VALORES IGUAIS MESMO SABENDO que TENHO DOIS OU MAIS VALORES!

Link para o comentário
Compartilhar em outros sites

3 respostass a esta questão

Posts Recomendados

  • 0

Mais ou menos assim:

<%
Dim conexao,constr,rs,soma, array(), array2), i, j, a

set conexao = createobject("AdoDb.connection")
constr = "Driver={Microsoft Access Driver (*.mdb)};DBQ="& server.MapPath("bancodedados.mdb")
conexao.open constr

set rs = conexao.execute("SELECT * FROM requisicoes order by codigo desc")

i = 0
j = 0
%>

<% while not rs.eof
ReDim Preserve array(i)
ReDim Preserve array2(j)
if rs("entregue") = "não" then if array(i) = "" then array(i) = rs("serventia") & array2(j) "val"
if rs("entregue") = "não" then if array2(j) = "" then array2(j) = rs("serventia")

%>
<% if rs("entregue") = "não" then soma = soma + 1 %>
<%
rs.MoveNext
i = i + 1
Wend

For a = 0 To i Step 1
   if array(i) <> "" then response.write array(i)
Next

For a = 0 To j Step 1
   if array2(j) <> "" then response.write array2(j)
Next

response.write soma%>

</font>
</body>
</html>

Link para o comentário
Compartilhar em outros sites

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.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152k
    • Posts
      651,8k
×
×
  • Criar Novo...