Ir para conteúdo

POWERED BY:

Arquivado

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

Boris

Problemas com busca ( like )

Recommended Posts

Galera estou tentando fazer uma busca e mas estou tendo problemas.

 

Eu executo a busca mas ele não está filtrando a e trazendo o que eu procuro.

 

Alguem pode me ajudar.

 

teste.asp

<!--#include file="conexao.asp"-->

<head>
<title></title>
<style type="text/css">
<!--
.cx {font-family: verdana;
	font-size: 10px;
	color: #333333;
	text-decoration: none;
}
.style1 {font-family: arial;
	color: #FFFFFF;
	font-weight: bold;
	font-size: 10px;
}
.style21 {color: #FFFFFF; font-weight: bold; font-size: 12px; font-family: Verdana, Arial, Helvetica, sans-serif; }
.style22 {	font-family: verdana;
	font-size: 11px;
	font-weight: bold;
}
.style6 {	font-family: verdana;
	font-weight: bold;
	font-size: 12px;
	color: #666666;
}
.style24 {font-family: verdana; font-size: 9px;}
.style25 {color: #FF0000}
.style26 {color: #FFFFFF; font-size: 10px; font-family: arial;}
-->
</style>
</head>

<body bgcolor="#0000CC" text="#000000" topmargin="52">

<table width="700" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
	<td> </td>
  </tr>
  <tr>
	<td height="207" align="center" valign="middle"><table width="700" border="0" align="center" cellpadding="0" cellspacing="0">
	  <tr>
		<td height="28" background="Imagens/line_fundo.jpg"><TABLE width="100%" border=0 align=center cellPadding=0 cellSpacing=0 class=texto>
			  <TR>
				<FORM method=post action="teste.asp"id=form1 name=form1>
				  <TD height="28" align="center" nowrap><table width="100%" height="28" border="0" cellspacing="2">
					  <tr align=center class=texto>
						<td width="22%" height="10"><div align="right"><span class="style26"><font face="Verdana, Arial, Helvetica, sans-serif">Tipo</font></span><span class="style1"><font face="Verdana, Arial, Helvetica, sans-serif">
							<% 
strQ = "SELECT DISTINCT * FROM tipo_imovel Where tp_imovel <> ''"
Set objRS = cn.Execute(strQ)

Response.Write "<SELECT  class='cx' NAME='tp_imovel'>"
Response.Write "<OPTION SELECTED></OPTION>"
 
If Not objRS.EOF Then
  While Not objRS.EOF
	Response.Write "<OPTION VALUE='" & objRS("tp_imovel") & "'"
	If Request("id_tp_imovel") = objRS("tp_imovel") Then Response.Write " selected"
	Response.Write ">" & objRS("tp_imovel") & "</OPTION>"
	objRS.MoveNext
  Wend
End If
 
Response.Write "</SELECT>"
 
set objRS = Nothing
%>
						</font></span></div></td>
						<td width="20%"><div align="right"><span class="style26"><font face="Verdana, Arial, Helvetica, sans-serif">Bairro: </font></span><font face="Verdana, Arial, Helvetica, sans-serif"><span class="style1">
						  <select  name="select" size="1" class="cx" id="select">
							<option>Selecione</option>
							<option value="Aluguel">Aluguel</option>
							<option value="Venda">Venda</option>
						  </select>
						</span></font></div></td>
						<td width="13%"><div align="right"> <span class="style26"><font face="Verdana, Arial, Helvetica, sans-serif">Ref.:</font></span><strong><font color="#000000" face="Verdana, Arial, Helvetica, sans-serif">
						  <input class="cx" name="referencia" type="text" id="referencia" style="font-family=Tahoma; font size=10" size="8" />
						</font></strong></div></td>
						<td width="16%"><div align="right"><strong><font color="#000000" face="Verdana, Arial, Helvetica, sans-serif">
						  <select class="cx" size="1" name="valor_minimo" style="{font-family:Tahoma; font-size:10}">
							<option value="0">Valor Mínimo</option>
							<option value="0">R$ 0</option>
							<option value="50000">R$ 50.000</option>
							<option value="100000">R$ 100.000</option>
							<option value="150000">R$ 150.000</option>
							<option value="200000">R$ 200.000</option>
							<option value="250000">R$ 250.000</option>
							<option value="300000">R$ 300.000</option>
							<option value="350000">R$ 350.000</option>
							<option value="400000">R$ 400.000</option>
							<option value="450000">R$ 450.000</option>
						  </select>
						</font></strong></div></td>
						<td width="17%"><div align="left"><strong><font color="#000000" face="Verdana, Arial, Helvetica, sans-serif">
						  <select size="1" class="cx" name="valor_maximo" style="{font-family:Tahoma; font-size:10}">
							<option value="1000000">Valor Máximo</option>
							<option value="50000">R$ 50.000</option>
							<option value="100000">R$ 100.000</option>
							<option value="150000">R$ 150.000</option>
							<option value="200000">R$ 200.000</option>
							<option value="250000">R$ 250.000</option>
							<option value="300000">R$ 300.000</option>
							<option value="350000">R$ 350.000</option>
							<option value="400000">R$ 400.000</option>
							<option value="450000">R$ 450.000</option>
							<option value="500000">R$ 500.000</option>
						  </select>
						</font></strong></div></td>
						<td width="12%"><div align="left"><strong><font color="#000000" face="Verdana, Arial, Helvetica, sans-serif">
						  <input type="image" src=Imagens/buscar.jpg align=absmiddle style="font-family=Tahoma; font size=10" id=image12 name=image1>
						</font></strong></div></td>
					  <tr>
				  </table></TD>
				</FORM>
			  </TR>
		  </TABLE></td>
		</tr>
	  <tr>
		<td width="691" height="10" valign="top"><table width="700" border="0" align="center" cellpadding="0" cellspacing="0">
		  <tr>
			<td height="10" bgcolor="#FFFFFF"> </td>
		  </tr>
		  <tr>
			<td height="152" valign="top" bgcolor="#FFFFFF"><div align="center"><span class="style6"> <span class="style24">
			  <%									  

 If Trim( Request.Form("tp_imovel") ) <> "" Then

comandosql = "SELECT tp_imovel, bairro, referencia FROM imovel WHERE (((tp_imovel) Like '*') AND ((bairro) Like '*') AND ((referencia) Like '*'))"

comandosql = "SELECT * FROM imovel "

  comandosql = comandosql & " Where tp_imovel Like '%" & Request("tp_imovel") & "%' "
  
  comandosql = comandosql & " AND desc_aluguel Like '%" & Request("desc_aluguel") & "%' "
  
  comandosql = comandosql & " AND referencia Like '%" & Request("referencia") & "%' "
  
'abreconexao

Set conexao =  Server.CreateObject("ADODB.Connection")
conexao.Open "DBQ=" & Server.MapPath("..\bd\bd.mdb") & ";Driver={Microsoft Access Driver (*.mdb)}"

comandosql = "SELECT * FROM imovel ORDER BY ativo desc"
Set consulta = conexao.Execute(comandosql)




'set consulta = conexao.execute(comandosql)

total = 0
while not consulta.EOF
total = total + 1
consulta.MoveNext
wend

%>
			</span>Resultado da Busca </span>
					</div>
				  <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
					  <tr>
						<td><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#0000CC">
							<tr>
							  <td height="10" colspan="5" bgcolor="#FFFFFF" class="cx"><div align="right">
								<table width="100%" border="0" cellspacing="0" cellpadding="0">
								  <tr>
									<td width="97%"><div align="right"><span class="style24">
									  
									  Registros encontrados:
									  <% = total %>
									</span></div></td>
									<td width="3%"> </td>
								  </tr>
								</table>
							  </div></td>
							</tr>
							<tr>
							  <td width="20%" height="29" class="cx"><DIV align="center" class="style21">Referência</DIV></td>
							  <td width="27%" class="cx"><DIV align="center" class="style21">Bairro</DIV></td>
							  <td width="16%" class="cx"><DIV align="center" class="style21">Dormitórios</DIV></td>
							  <td width="12%" class="cx"><DIV align="center" class="style21">Vagas</DIV></td>
							  <td width="25%" class="cx"><DIV align="center" class="style21">Preço</DIV></td>
							</tr>
						</table></td>
					  </tr>
					  <tr>
						<td valign="top"><%
if total > 0 then
consulta.MoveFirst
%>
						  <div align="center">
							<center>
							  <table border="0" width="100%" cellspacing="1">
								<%

while not consulta.EOF

n = consulta("id_imovel")
%>
								<tr>
								  <td width="135" height="20" class="cx"><a href="ve_imovel.asp?id_imovel=<%=consulta("id_imovel")%>" style="text-decoration:none; color:#000000"><% =consulta("referencia") %> - <% =consulta("tp_imovel") %>
									</a></td>
								  <td width="187" class="cx"><div align="left"><a href="ve_imovel.asp?id_imovel=<%=consulta("id_imovel")%>" style="text-decoration:none; color:#000000">
									<% =consulta("bairro") %>
								  </a></div></td>
								  <td width="111" class="cx"><div align="center"><a href="ve_imovel.asp?id_imovel=<%=consulta("id_imovel")%>" style="text-decoration:none; color:#000000">
									<% =consulta("dormitorios") %>
								  </a></div></td>
								  <td width="80" class="cx"><div align="center"><a href="ve_imovel.asp?id_imovel=<%=consulta("id_imovel")%>" style="text-decoration:none; color:#000000">
									<% =consulta("vagas") %>
								  </a></div></td>
								  <td width="37" class="cx"><div align="right"><strong>R$</strong></div></td>
								  <td width="131" class="cx"><a href="ve_imovel.asp?id_imovel=<%=consulta("id_imovel")%>" style="text-decoration:none; color:#000000">
								  <% =consulta("valor") %>
								  </a></td>
								</tr>
								<%

consulta.MoveNext
WEnd

%>
							  </table><hr>
							  <br>
							</center>
						  </div>
						  <%
end if
'fechaconexao
  conexao.close
  Set conexao = Nothing
else 
%>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
							<tr>
							  <td class="style6"><br>
<br>
<div align="center" class="style6 style25">Nenhum registro encotrado</div></td>
							</tr>
						  </table><br>
						
						 
<%
end if

%>						  </td>
					  </tr>
					  <tr>
						<td valign="top"><table width="700" border="0" align="center" cellpadding="0" cellspacing="0">
							<tr>
							  <td height="30" bgcolor="#0059B3"> </td>
							</tr>
						</table></td>
					  </tr>
				  </table></td>
		  </tr>
		</table></td>
	  </tr>
	</table></td>
  </tr>
</table>
<p align="right"><b><br>
<br></b></p>

 

Valew pela força galera

Compartilhar este post


Link para o post
Compartilhar em outros sites

retire essa linha, ela está atribuindo novos valores para a variavel

comandosql = "SELECT * FROM imovel ORDER BY ativo desc"

Compartilhar este post


Link para o post
Compartilhar em outros sites

olá Boris, esse é meu primeiro Post, espero que ajude...

 

O erro está no seu select, em:

 

strQ = "SELECT DISTINCT * FROM tipo_imovel Where tp_imovel <> ''"
Set objRS = cn.Execute(strQ)

 

O DISTINCT tem que especificar alguma coluna, por exemplo:

strQ = "SELECT DISTINCT(tp_imovel) FROM tipo_imovel WHERE tp_imovel <> ''"
Set objRS = cn.Execute(strQ)

e aconselho, no lugar de:
	WHERE tp_imovel <> ''"
coloque:
	WHERE tp_imovel IS NOT NULL

Bem... isso deve resolver...

...qualquer outro problema... estamos ai!

Compartilhar este post


Link para o post
Compartilhar em outros sites

ok, ele está procurando pelo campo tipo porem não estou conseguindo concatenar com os outros campos por exemplo.

 

Apartamento + Aluguel = todos apartamentos que sejam aluguel independente da referencia

 

Apartamento + Aluguel + referencia = todos apartamentos que sejam alugel de uma determinada referencia

 

Aluguel = todos que sejam aluguel

 

E assim por diante...

 

Eu vou tentando fazer aqui se eu consegui alguma coisa eu post aqui tbm

Compartilhar este post


Link para o post
Compartilhar em outros sites

Tente algo como:

strQ = "SELECT * FROM tipo_imovel WHERE nomedacolunax = 'Aluguel' AND nomedacolunay = 'referência'"
Set objRS = cn.Execute(strQ)

vale lembrar, que "A" é diferente de "a", então no exemplo acima, "referência" é diferente de "Referência" ou "REFERÊNCIA".

Compartilhar este post


Link para o post
Compartilhar em outros sites

Galera não sei o que estou fazendo de errado mas quando eu coloco apenas a desc_aluguel ou apenas a referencia ele não aceita.

 

So quando eu coloco Apartamento + referencia

 

o que estou fazendo de errado ???

 

 

teste.asp

<!--#include file="conexao.asp"-->


<head>
<title></title>
<style type="text/css">
<!--
.cx {font-family: verdana;
	font-size: 10px;
	color: #333333;
	text-decoration: none;
}
.style1 {font-family: arial;
	color: #FFFFFF;
	font-weight: bold;
	font-size: 10px;
}
.style21 {color: #FFFFFF; font-weight: bold; font-size: 12px; font-family: Verdana, Arial, Helvetica, sans-serif; }
.style22 {	font-family: verdana;
	font-size: 11px;
	font-weight: bold;
}
.style6 {	font-family: verdana;
	font-weight: bold;
	font-size: 12px;
	color: #666666;
}
.style24 {font-family: verdana; font-size: 9px;}
.style25 {color: #FF0000}
.style26 {color: #FFFFFF; font-size: 10px; font-family: arial;}
-->
</style>
</head>

<body bgcolor="#0000CC" text="#000000" topmargin="52">

<table width="700" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
	<td><img src="Imagens/topo.gif" width="700" height="87"></td>
  </tr>
  <tr>
	<td height="207" align="center" valign="middle"><table width="700" border="0" align="center" cellpadding="0" cellspacing="0">
	  <tr>
		<td height="28" background="Imagens/line_fundo.jpg"><TABLE width="100%" border=0 align=center cellPadding=0 cellSpacing=0 class=texto>
			  <TR>
				<FORM method=post action="teste.asp"id=form1 name=form1>
				  <TD height="28" align="center" nowrap><table width="100%" height="28" border="0" cellspacing="2">
					  <tr align=center class=texto>
						<td width="22%" height="10"><div align="right"><span class="style26"><font face="Verdana, Arial, Helvetica, sans-serif">Tipo</font></span><span class="style1"><font face="Verdana, Arial, Helvetica, sans-serif">
						 <% 
						 
tp_imovel = Request("tp_imovel")	
desc_aluguel = Request("desc_aluguel")
referencia = Request("referencia")


strQ = "SELECT * FROM tipo_imovel WHERE desc_aluguel = 'desc_aluguel' AND referencia = 'referência'" 
strQ = "SELECT * FROM tipo_imovel WHERE tp_imovel IS NOT NULL"
Set objRS = cn.Execute(strQ)

Response.Write "<SELECT  class='cx' NAME='tp_imovel'>"
Response.Write " <option>Selecione</option>"
 
If Not objRS.EOF Then
  While Not objRS.EOF
	Response.Write "<OPTION VALUE='" & objRS("tp_imovel") & "'"
	If Request("id_tp_imovel") = objRS("tp_imovel") Then Response.Write " selected"
	Response.Write ">" & objRS("tp_imovel") & "</OPTION>"
	objRS.MoveNext
  Wend
End If
 
Response.Write "</SELECT>"
 
set objRS = Nothing
%>
						</font></span></div></td>
						<td width="20%"><div align="right"><span class="style26"><font face="Verdana, Arial, Helvetica, sans-serif">Bairro: </font></span><font face="Verdana, Arial, Helvetica, sans-serif"><span class="style1">
						  <select  name="select" size="1" class="cx" id="select">
							<option>Selecione</option>
							<option value="Aluguel">Aluguel</option>
							<option value="Venda">Venda</option>
						  </select>
						</span></font></div></td>
						<td width="13%"><div align="right"> <span class="style26"><font face="Verdana, Arial, Helvetica, sans-serif">Ref.:</font></span><strong><font color="#000000" face="Verdana, Arial, Helvetica, sans-serif">
						  <input class="cx" name="referencia" type="text" id="referencia" style="font-family=Tahoma; font size=10" size="8" />
						</font></strong></div></td>
						<td width="16%"><div align="right"><strong><font color="#000000" face="Verdana, Arial, Helvetica, sans-serif">
						  <select class="cx" size="1" name="valor_minimo" style="{font-family:Tahoma; font-size:10}">
							<option value="0">Valor Mínimo</option>
							<option value="0">R$ 0</option>
							<option value="50000">R$ 50.000</option>
							<option value="100000">R$ 100.000</option>
							<option value="150000">R$ 150.000</option>
							<option value="200000">R$ 200.000</option>
							<option value="250000">R$ 250.000</option>
							<option value="300000">R$ 300.000</option>
							<option value="350000">R$ 350.000</option>
							<option value="400000">R$ 400.000</option>
							<option value="450000">R$ 450.000</option>
						  </select>
						</font></strong></div></td>
						<td width="17%"><div align="left"><strong><font color="#000000" face="Verdana, Arial, Helvetica, sans-serif">
						  <select size="1" class="cx" name="valor_maximo" style="{font-family:Tahoma; font-size:10}">
							<option value="1000000">Valor Máximo</option>
							<option value="50000">R$ 50.000</option>
							<option value="100000">R$ 100.000</option>
							<option value="150000">R$ 150.000</option>
							<option value="200000">R$ 200.000</option>
							<option value="250000">R$ 250.000</option>
							<option value="300000">R$ 300.000</option>
							<option value="350000">R$ 350.000</option>
							<option value="400000">R$ 400.000</option>
							<option value="450000">R$ 450.000</option>
							<option value="500000">R$ 500.000</option>
						  </select>
						</font></strong></div></td>
						<td width="12%"><div align="left"><strong><font color="#000000" face="Verdana, Arial, Helvetica, sans-serif">
						  <input type="image" src=Imagens/buscar.jpg align=absmiddle style="font-family=Tahoma; font size=10" id=image12 name=image1>
						</font></strong></div></td>
					  <tr>
				  </table></TD>
				</FORM>
			  </TR>
		  </TABLE></td>
		</tr>
	  <tr>
		<td width="691" height="10" valign="top"><table width="700" border="0" align="center" cellpadding="0" cellspacing="0">
		  <tr>
			<td height="10" bgcolor="#FFFFFF"> </td>
		  </tr>
		  <tr>
			<td height="152" valign="top" bgcolor="#FFFFFF"><div align="center"><span class="style6"> <span class="style24">
			  <%									  

 If Trim( Request.Form("tp_imovel") ) <> "" Then

comandosql = "SELECT tp_imovel, desc_aluguel, referencia FROM imovel WHERE (((tp_imovel) Like '*') AND ((desc_aluguel) Like '*') AND ((referencia) Like '*'))"

comandosql = "SELECT * FROM imovel "

  comandosql = comandosql & " Where tp_imovel Like '%" & Request("tp_imovel") & "%' AND desc_aluguel Like '%" & Request("desc_aluguel") & "%' AND referencia Like '%" & Request("referencia") & "%' "
  
'abreconexao

Set conexao =  Server.CreateObject("ADODB.Connection")
conexao.Open "DBQ=" & Server.MapPath("..\bd\bd.mdb") & ";Driver={Microsoft Access Driver (*.mdb)}"
Set consulta = conexao.Execute(comandosql)

total = 0
while not consulta.EOF
total = total + 1
consulta.MoveNext
wend

%>
			</span>Resultado da Busca </span>
					</div>
				  <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
					  <tr>
						<td><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#0000CC">
							<tr>
							  <td height="10" colspan="5" bgcolor="#FFFFFF" class="cx"><div align="right">
								<table width="100%" border="0" cellspacing="0" cellpadding="0">
								  <tr>
									<td width="97%"><div align="right"><span class="style24">
									  
									  Registros encontrados:
									  <% = total %>
									</span></div></td>
									<td width="3%"> </td>
								  </tr>
								</table>
							  </div></td>
							</tr>
							<tr>
							  <td width="20%" height="29" class="cx"><DIV align="center" class="style21">Referência</DIV></td>
							  <td width="27%" class="cx"><DIV align="center" class="style21">Bairro</DIV></td>
							  <td width="16%" class="cx"><DIV align="center" class="style21">Dormitórios</DIV></td>
							  <td width="12%" class="cx"><DIV align="center" class="style21">Vagas</DIV></td>
							  <td width="25%" class="cx"><DIV align="center" class="style21">Preço</DIV></td>
							</tr>
						</table></td>
					  </tr>
					  <tr>
						<td valign="top"><%
if total > 0 then
consulta.MoveFirst
%>
						  <div align="center">
							<center>
							  <table border="0" width="100%" cellspacing="1">
								<%

while not consulta.EOF

n = consulta("id_imovel")
%>
								<tr>
								  <td width="135" height="20" class="cx"><a href="ve_imovel.asp?id_imovel=<%=consulta("id_imovel")%>" style="text-decoration:none; color:#000000"><% =consulta("referencia") %> - <% =consulta("tp_imovel") %>
									</a></td>
								  <td width="187" class="cx"><div align="left"><a href="ve_imovel.asp?id_imovel=<%=consulta("id_imovel")%>" style="text-decoration:none; color:#000000">
									<% =consulta("bairro") %>
								  </a> - <a href="ve_imovel.asp?id_imovel=<%=consulta("id_imovel")%>" style="text-decoration:none; color:#000000">
								  <% =consulta("desc_aluguel") %>
								  </a></div></td>
								  <td width="111" class="cx"><div align="center"><a href="ve_imovel.asp?id_imovel=<%=consulta("id_imovel")%>" style="text-decoration:none; color:#000000">
									<% =consulta("dormitorios") %>
								  </a></div></td>
								  <td width="80" class="cx"><div align="center"><a href="ve_imovel.asp?id_imovel=<%=consulta("id_imovel")%>" style="text-decoration:none; color:#000000">
									<% =consulta("vagas") %>
								  </a></div></td>
								  <td width="37" class="cx"><div align="right"><strong>R$</strong></div></td>
								  <td width="131" class="cx"><a href="ve_imovel.asp?id_imovel=<%=consulta("id_imovel")%>" style="text-decoration:none; color:#000000">
								  <% =consulta("valor") %>
								  </a></td>
								</tr>
								<%

consulta.MoveNext
WEnd

%>
							  </table><hr>
							  <br>
							</center>
						  </div>
						  <%
end if
'fechaconexao
  conexao.close
  Set conexao = Nothing
else 
%>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
							<tr>
							  <td class="style6"><br>
<br>
<div align="center" class="style6 style25">Nenhum registro encotrado</div></td>
							</tr>
						  </table><br>
						
						 
<%
end if

%>						  </td>
					  </tr>
					  <tr>
						<td valign="top"><table width="700" border="0" align="center" cellpadding="0" cellspacing="0">
							<tr>
							  <td height="30" bgcolor="#0059B3"><div align="center"><span class="style22"><font color="#FFFFFF">Moradia Imobiliária 
								- Tel.: (11) 6546.2299 – Fax: (11) 6943.2121 - contato@moradia.imb.br</font></span></div></td>
							</tr>
						</table></td>
					  </tr>
				  </table></td>
		  </tr>
		</table></td>
	  </tr>
	</table></td>
  </tr>
</table>
<p align="right"><b><br>
<br></b></p>

 

 

Alguem pode me ajudar ?

Compartilhar este post


Link para o post
Compartilhar em outros sites

mas o que nao ta buscando corretamente?

Compartilhar este post


Link para o post
Compartilhar em outros sites

O sistema não está buscando por exemplo.

 

Quando coloco só apatamento

quando coloco só aluguel

quando coloco só a referencia

 

Ele so busca quando coloco apartamento + referencia

nem quando coloco apartameto + aluguel ele busca

Compartilhar este post


Link para o post
Compartilhar em outros sites

como está montando sua consulta?

Compartilhar este post


Link para o post
Compartilhar em outros sites

Estou montando da seguinte forma:

 

If Trim( Request.Form("tp_imovel") ) <> "" Then

 

comandosql = "SELECT tp_imovel, desc_aluguel, referencia FROM imovel WHERE (((tp_imovel) Like '*') AND ((desc_aluguel) Like '*') AND ((referencia) Like '*'))"

 

comandosql = "SELECT * FROM imovel "

 

comandosql = comandosql & " Where tp_imovel Like '%" & Request("tp_imovel") & "%' AND desc_aluguel Like '%" & Request("desc_aluguel") & "%' AND referencia Like '%" & Request("referencia") & "%' "

 

'abreconexao

Compartilhar este post


Link para o post
Compartilhar em outros sites

voce deve montar a partir do que vem do formulario

 

a cada campo voce testa apra ver se veio algo

 

se veio voce concatena senao nao faz nada

 

entendeu, monta parte por parte

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.