Galera,
Estou com uma dúvida com a Condição IF, como fazer para verificar uma variável se é 1, 2, 3 ou 4, faz uma coisa senão faz outra...
Fiz assim, mas não funcionou direito...
if categoria = "1,2,3,4" then
.....
.....
else
......
.....
end if
====================
Acho q está errado como defini = "1,2,3,4"
Como faço uma verificação desse tipo? A variável vai receber um desses valores.
Luis Carlos

Dúvida Com Condição If...
Started By luiscarlos5046, 23/03/2005, 16:47
3 replies to this topic
#1
Posted 23/03/2005, 16:47
#2
Posted 23/03/2005, 18:13
É assim que funciona!!
If Variavel = 1 then
-
-
-
-
-
else
if Variavel = 2 then
-
-
-
-
else
if variavel = 3 then
-
-
-
-
-
else
Faça ta coisa !!
end if
end if
end if
tem que ter um end para cada if entendeu, a última não tem o if pois só sobra o 4
Ta ok !!!
Então blz !!!
Tamos na área
If Variavel = 1 then
-
-
-
-
-
else
if Variavel = 2 then
-
-
-
-
else
if variavel = 3 then
-
-
-
-
-
else
Faça ta coisa !!
end if
end if
end if
tem que ter um end para cada if entendeu, a última não tem o if pois só sobra o 4
Ta ok !!!
Então blz !!!
Tamos na área
#3
Posted 24/03/2005, 09:02
Valeu ai,
eu precisava desse tipo:
==================================================
SELECT CASE categoria
CASE 1, 2, 3, 4
Set TbCod = Server.CreateObject("ADODB.RECORDSET")
TbCod.Open "SELECT TOP 1 produtos_id FROM produtos......
if TbCod.eof = true then
ultimo_id = 1
else
ultimo_id = Cint(TbCod.fields("produtos_id"))
end if
cn.Execute("INSERT INTO categpr............
CASE ""
strOk = ""
strOk = strOk & "Não foi possí......................
strOk = strOk & "<a href='add.asp'>Cliqu...........
END SELECT
==================================================
Acho que isso tbm funciona.... pelo meno parece q está funcionando...
Caso for 1 ou 2 ou 3 ou 4 executa comandoa...
Caso estiver vazio, mostra q houve erro...
Certo ????
Luis Carlos
eu precisava desse tipo:
==================================================
SELECT CASE categoria
CASE 1, 2, 3, 4
Set TbCod = Server.CreateObject("ADODB.RECORDSET")
TbCod.Open "SELECT TOP 1 produtos_id FROM produtos......
if TbCod.eof = true then
ultimo_id = 1
else
ultimo_id = Cint(TbCod.fields("produtos_id"))
end if
cn.Execute("INSERT INTO categpr............
CASE ""
strOk = ""
strOk = strOk & "Não foi possí......................
strOk = strOk & "<a href='add.asp'>Cliqu...........
END SELECT
==================================================
Acho que isso tbm funciona.... pelo meno parece q está funcionando...
Caso for 1 ou 2 ou 3 ou 4 executa comandoa...
Caso estiver vazio, mostra q houve erro...
Certo ????
Luis Carlos
#4
Posted 24/03/2005, 10:32
certo.. eh até mais fácil de ler... rs..
flws...
flws...

> ls -la
-rwxr-xr-- 1 fmaynnard user 9666 nov 28 00:00 hell
> shutdown -h now
-rwxr-xr-- 1 fmaynnard user 9666 nov 28 00:00 hell
> shutdown -h now
1 user(s) are reading this topic
0 membro(s), 1 visitante(s) e 0 membros anônimo(s)