Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

shumi

Condição

Recommended Posts

Galera,

beleza?

 

Hoje to chato aqui em ASP hein!

To com uma dúvida muito chata, to tentando faz um tempinho e não consegui solucionar.

Tipo eu tenho um formulário, onde o user escolhe ou praca, ou cod, ou carteira, ou chopp e embaixo de cada select tem um botão filtrar. beleza até ai, na outra pagina onde resgato as informações eu teria que fazer uma condição que seria mais ou menos assim:

 

Se praca tem valor então

Ação

se cod tem valor então

Ação

se carteira tem valor então

Ação

Se chopp tem valor então

Ação

 

Ai to quebrando a cabeça pra fazer e fiz assim:

<%IF praca = "" ThenSql = "Select codbar from cad_bares where praca='"&praca&"'"Set rscodbar = Conexcao.Execute(Sql)codbar = rscodbar("codbar")Sql = "Select * from cad_bares where codbar = '"&codbar&"'"Set rs = Conexcao.Execute(Sql)Sql2 = "Select * from promocoes where codbar = "&codbarSet rs2 = Conexcao.Execute(Sql2)Sql3 = "Select * from merchandising where codbar = "&codbarSet rs3 = Conexcao.Execute(Sql3)Sql4 = "Select * from status where codbar = "&codbarSet rs4 = Conexcao.Execute(Sql4)Sql5 = "Select * from perguntas where codbar = "&codbarSet rs5 = Conexcao.Execute(Sql5)Sql6 = "Select * from status_new where codbar = "&codbarSet rs6 = Conexcao.Execute(Sql6)ElseIF codbar = "" ThenSql = "Select * from cad_bares where codbar = '"&codbar&"'"Set rs = Conexcao.Execute(Sql)Sql2 = "Select * from promocoes where codbar = "&codbarSet rs2 = Conexcao.Execute(Sql2)Sql3 = "Select * from merchandising where codbar = "&codbarSet rs3 = Conexcao.Execute(Sql3)Sql4 = "Select * from status where codbar = "&codbarSet rs4 = Conexcao.Execute(Sql4)Sql5 = "Select * from perguntas where codbar = "&codbarSet rs5 = Conexcao.Execute(Sql5)Sql6 = "Select * from status_new where codbar = "&codbarSet rs6 = Conexcao.Execute(Sql6)ElseIF carteira = "" ThenSql = "Select codbar from cad_bares where carteira='"&carteira&"'"Set rscodbar = Conexcao.Execute(Sql)codbar = rscodbar("codbar")Sql = "Select * from cad_bares where codbar = '"&codbar&"'"Set rs = Conexcao.Execute(Sql)Sql2 = "Select * from promocoes where codbar = "&codbarSet rs2 = Conexcao.Execute(Sql2)Sql3 = "Select * from merchandising where codbar = "&codbarSet rs3 = Conexcao.Execute(Sql3)Sql4 = "Select * from status where codbar = "&codbarSet rs4 = Conexcao.Execute(Sql4)Sql5 = "Select * from perguntas where codbar = "&codbarSet rs5 = Conexcao.Execute(Sql5)Sql6 = "Select * from status_new where codbar = "&codbarSet rs6 = Conexcao.Execute(Sql6)ElseIF chopp = "" ThenSql = "Select codbar from cad_bares where chopp='"&chopp&"'"Set rscodbar = Conexcao.Execute(Sql)codbar = rscodbar("codbar")Sql = "Select * from cad_bares where codbar = '"&codbar&"'"Set rs = Conexcao.Execute(Sql)Sql2 = "Select * from promocoes where codbar = "&codbarSet rs2 = Conexcao.Execute(Sql2)Sql3 = "Select * from merchandising where codbar = "&codbarSet rs3 = Conexcao.Execute(Sql3)Sql4 = "Select * from status where codbar = "&codbarSet rs4 = Conexcao.Execute(Sql4)Sql5 = "Select * from perguntas where codbar = "&codbarSet rs5 = Conexcao.Execute(Sql5)Sql6 = "Select * from status_new where codbar = "&codbarSet rs6 = Conexcao.Execute(Sql6)Else	Response.Redirect("relatorio.asp?msg=1")End If%>
Mas qualquer valor que jogo da sempre a mesma resposta, ai todas para a ultima ação http://forum.imasters.com.br/public/style_emoticons/default/ermm.gif

Else

Response.Redirect("relatorio.asp?msg=1")

 

Obrigado

Compartilhar este post


Link para o post
Compartilhar em outros sites

se tento assim:

<%if not praca.EOF thenSql = "Select codbar from cad_bares where praca='"&praca&"'"Set rscodbar = Conexcao.Execute(Sql)codbarrr = rscodbar("codbar")Sql = "Select * from cad_bares where codbar = '"&codbarrr&"'"Set rs = Conexcao.Execute(Sql)Sql2 = "Select * from promocoes where codbar = "&codbarrrSet rs2 = Conexcao.Execute(Sql2)Sql3 = "Select * from merchandising where codbar = "&codbarrrSet rs3 = Conexcao.Execute(Sql3)Sql4 = "Select * from status where codbar = "&codbarrrSet rs4 = Conexcao.Execute(Sql4)Sql5 = "Select * from perguntas where codbar = "&codbarrrSet rs5 = Conexcao.Execute(Sql5)Sql6 = "Select * from status_new where codbar = "&codbarrrSet rs6 = Conexcao.Execute(Sql6)Elseif not codbar.EOF thenSql = "Select * from cad_bares where codbar = '"&codbar&"'"Set rs = Conexcao.Execute(Sql)Sql2 = "Select * from promocoes where codbar = "&codbarSet rs2 = Conexcao.Execute(Sql2)Sql3 = "Select * from merchandising where codbar = "&codbarSet rs3 = Conexcao.Execute(Sql3)Sql4 = "Select * from status where codbar = "&codbarSet rs4 = Conexcao.Execute(Sql4)Sql5 = "Select * from perguntas where codbar = "&codbarSet rs5 = Conexcao.Execute(Sql5)Sql6 = "Select * from status_new where codbar = "&codbarSet rs6 = Conexcao.Execute(Sql6)Elseif not carteira.EOF thenSql = "Select codbar from cad_bares where carteira='"&carteira&"'"Set rscodbar = Conexcao.Execute(Sql)codbarrr = rscodbar("codbar")Sql = "Select * from cad_bares where codbar = '"&codbarrr&"'"Set rs = Conexcao.Execute(Sql)Sql2 = "Select * from promocoes where codbar = "&codbarrrSet rs2 = Conexcao.Execute(Sql2)Sql3 = "Select * from merchandising where codbar = "&codbarrrSet rs3 = Conexcao.Execute(Sql3)Sql4 = "Select * from status where codbar = "&codbarrrSet rs4 = Conexcao.Execute(Sql4)Sql5 = "Select * from perguntas where codbar = "&codbarrrSet rs5 = Conexcao.Execute(Sql5)Sql6 = "Select * from status_new where codbar = "&codbarrrSet rs6 = Conexcao.Execute(Sql6)Elseif not chopp.EOF thenSql = "Select codbar from cad_bares where chopp='"&chopp&"'"Set rscodbar = Conexcao.Execute(Sql)codbarrr = rscodbar("codbar")Sql = "Select * from cad_bares where codbar = '"&codbarrr&"'"Set rs = Conexcao.Execute(Sql)Sql2 = "Select * from promocoes where codbar = "&codbarrrSet rs2 = Conexcao.Execute(Sql2)Sql3 = "Select * from merchandising where codbar = "&codbarrrSet rs3 = Conexcao.Execute(Sql3)Sql4 = "Select * from status where codbar = "&codbarrrSet rs4 = Conexcao.Execute(Sql4)Sql5 = "Select * from perguntas where codbar = "&codbarrrSet rs5 = Conexcao.Execute(Sql5)Sql6 = "Select * from status_new where codbar = "&codbarrrSet rs6 = Conexcao.Execute(Sql6)Else	Response.Redirect("relatorio.asp?msg=1")End If%>
da o erro:

Microsoft VBScript runtime error '800a01a8' Object required: '...' /ambev/painelambev/relatorio_filtro_praca.asp, line 55

:unsure:

Compartilhar este post


Link para o post
Compartilhar em outros sites

Galera andei percebendo agora que quando escolho a opção de filtro o resultado que é passado para outra pagina se não coloco nada é 3 pontos.Na condição então tenho que colocar:Se valor for diferente de 3 pontinhos façatal coisa???Como que é o operador para de diferença???Valeu

Compartilhar este post


Link para o post
Compartilhar em outros sites

diferença é <>

Compartilhar este post


Link para o post
Compartilhar em outros sites

Consegui!!!

Valeu Tio Mario!!!

 

veja como fiz:

 

if praca <> "..." thenSql = "Select codbar from cad_bares where praca='"&praca&"'"Set rscodbar = Conexcao.Execute(Sql)codbarrr = rscodbar("codbar")Sql = "Select * from cad_bares where codbar = '"&codbarrr&"'"Set rs = Conexcao.Execute(Sql)Sql2 = "Select * from promocoes where codbar = "&codbarrrSet rs2 = Conexcao.Execute(Sql2)Sql3 = "Select * from merchandising where codbar = "&codbarrrSet rs3 = Conexcao.Execute(Sql3)Sql4 = "Select * from status where codbar = "&codbarrrSet rs4 = Conexcao.Execute(Sql4)Sql5 = "Select * from perguntas where codbar = "&codbarrrSet rs5 = Conexcao.Execute(Sql5)Sql6 = "Select * from status_new where codbar = "&codbarrrSet rs6 = Conexcao.Execute(Sql6)Elseif codbar <> "..." thenSql = "Select * from cad_bares where codbar = '"&codbar&"'"Set rs = Conexcao.Execute(Sql)Sql2 = "Select * from promocoes where codbar = "&codbarSet rs2 = Conexcao.Execute(Sql2)Sql3 = "Select * from merchandising where codbar = "&codbarSet rs3 = Conexcao.Execute(Sql3)Sql4 = "Select * from status where codbar = "&codbarSet rs4 = Conexcao.Execute(Sql4)Sql5 = "Select * from perguntas where codbar = "&codbarSet rs5 = Conexcao.Execute(Sql5)Sql6 = "Select * from status_new where codbar = "&codbarSet rs6 = Conexcao.Execute(Sql6)Elseif carteira <> "..." thenSql = "Select codbar from cad_bares where carteira='"&carteira&"'"Set rscodbar = Conexcao.Execute(Sql)codbarrr = rscodbar("codbar")Sql = "Select * from cad_bares where codbar = '"&codbarrr&"'"Set rs = Conexcao.Execute(Sql)Sql2 = "Select * from promocoes where codbar = "&codbarrrSet rs2 = Conexcao.Execute(Sql2)Sql3 = "Select * from merchandising where codbar = "&codbarrrSet rs3 = Conexcao.Execute(Sql3)Sql4 = "Select * from status where codbar = "&codbarrrSet rs4 = Conexcao.Execute(Sql4)Sql5 = "Select * from perguntas where codbar = "&codbarrrSet rs5 = Conexcao.Execute(Sql5)Sql6 = "Select * from status_new where codbar = "&codbarrrSet rs6 = Conexcao.Execute(Sql6)Elseif praca <> "..." thenSql = "Select codbar from cad_bares where chopp='"&chopp&"'"Set rscodbar = Conexcao.Execute(Sql)codbarrr = rscodbar("codbar")Sql = "Select * from cad_bares where codbar = '"&codbarrr&"'"Set rs = Conexcao.Execute(Sql)Sql2 = "Select * from promocoes where codbar = "&codbarrrSet rs2 = Conexcao.Execute(Sql2)Sql3 = "Select * from merchandising where codbar = "&codbarrrSet rs3 = Conexcao.Execute(Sql3)Sql4 = "Select * from status where codbar = "&codbarrrSet rs4 = Conexcao.Execute(Sql4)Sql5 = "Select * from perguntas where codbar = "&codbarrrSet rs5 = Conexcao.Execute(Sql5)Sql6 = "Select * from status_new where codbar = "&codbarrrSet rs6 = Conexcao.Execute(Sql6)ElseResponse.Redirect("relatorio.asp?msg=1")End If

Abraços

Compartilhar este post


Link para o post
Compartilhar em outros sites

Consegui!!!Valeu Tio Mario!!!Abraços

Parabens shumi http://forum.imasters.com.br/public/style_emoticons/default/clap.gif

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.