Ir para conteúdo

POWERED BY:

Arquivado

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

Boris

Erro na busca

Recommended Posts

Galera estou tendo problema no momento de fazer uma busca...

 

o erro é o seguinte

 

 

Informações técnicas (para a equipe de suporte)

 

Tipo de erro:

Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)

[Microsoft][Driver ODBC para Microsoft Access] Erro de sintaxe na cláusula FROM.

/Moradia/MODELO/seg_asp/buscar.asp, line 345

 

 

Tipo de navegador:

Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727)

 

Página:

POST 108 bytes to /Moradia/MODELO/seg_asp/buscar.asp

 

POST Data:

tp_imovel=0&desc_aluguel=0&referencia=Ref_-335-C&valor_minimo=1&valor_maximo=9999999&image1.x=31&image1.y=10

 

Hora:

quinta-feira, 10 de julho de 2008, 22:07:37

 

 

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

tp_imovel = Request.form("tp_imovel")	
desc_aluguel = Request.form("desc_aluguel")
referencia = Request.form("referencia")
valor_minimo = Request.form("valor_minimo")
valor_maximo = Request.form("valor_maximo")
%>



<html>
<head>
<title>Moradia Imobiliária</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.style1 {
	font-family: arial;
	color: #FFFFFF;
	font-weight: bold;
	font-size: 10px;
}
.cx {
	font-family: verdana;
	font-size: 10px;
	color: #333333;
	text-decoration: none;
}
.textobr {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 8pt; font-weight: bold; color: #FFFFFF; text-decoration: none}
.style2 {color: #FFFFFF; font-size: 10px; font-family: arial;}
.texto {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; color: #666666; text-decoration: none}
.texto1 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; color: #000000; text-decoration: none}
.style48 {color: #333333}
.style50 {font-weight: bold; font-size: 10px; font-family: arial;}
.style51 {font-size: 10px; text-decoration: none; font-family: verdana;}
.style31 {color: #666666; font-weight: bold; font-size: 14px; font-family: Verdana, Arial, Helvetica, sans-serif; }
.style36 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; color: #666666; }
.style39 {	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 12;
	text-decoration: none;
	color: #666666;
}
.style47 {font-weight: bold; font-family: Verdana, Arial, Helvetica, sans-serif; color: #FFFFFF; font-size: 8pt; }

-->
</style>
<script type="text/JavaScript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
//-->
</script>
</head>

<body bgcolor="#0000CC" text="#000000" topmargin="52">
<form name="form2" method="post" action="buscar.asp">
  <table border="0" cellspacing="0" cellpadding="2" align="center" bordercolor="#000000" width="700">
	<tr>
	  <td valign="top" bgcolor="#000000"><table width="100%" border="0" cellspacing="0" cellpadding="0">
		  <tr>
			<td bgcolor="#0000cc"><table width="700" border="0" align="center" cellpadding="0" cellspacing="0">
				<tr>
				  <td height="87" valign="top" background="../modelo2/img/topo.jpg"><img src="Imagens/topo.gif" width="700" height="87" border="0" usemap="#Map">
					  <map name="Map">
						<area shape="rect" coords="633,17,693,75" href="../email.asp">
						<area shape="rect" coords="541,17,625,77" href="../encomenda.asp">
						<area shape="rect" coords="448,17,532,77" href="../cadastro.asp">
						<area shape="rect" coords="359,17,443,77" href="../empresa.asp">
						<area shape="rect" coords="273,17,357,77" href="../index.asp">
				  </map></td>
				</tr>
				<tr>
				  <td height="10" align="center" valign="middle"><table width="700" border="0" align="center" cellpadding="0" cellspacing="0">
					  <tr>
						<td height="28" background="seg_asp/Imagens/line_fundo.jpg"><div align="right">
							<TABLE width="100%" border=0 align=center cellPadding=0 cellSpacing=0 class=texto>
							  <TR>
								<TD height="1" align="center" nowrap><table width="100%" height="24" border="0" cellspacing="2">
									<tr align=center class=texto>
									  <td width="23%" height="20"><div align="right" class="style48"><span class="style2"><font face="Verdana, Arial, Helvetica, sans-serif">Tipo</font></span><span class="style50"><font face="Verdana, Arial, Helvetica, sans-serif"></font><font face="Verdana, Arial, Helvetica, sans-serif">
										  <% 
tp_imovel = Request.Form("tp_imovel")	
desc_aluguel = Request.form("desc_aluguel")
referencia = Request.form("referencia")


'strQ = "SELECT * FROM tipo_imovel WHERE desc_aluguel = 'desc_aluguel' AND referencia = 'referência'" 'Pra que você utilizou esta linha?

strQ = "SELECT * FROM tipo_imovel WHERE ativo='1'"
Set objRS = cn.Execute(strQ)

%>
										  <select  class='cx' name='tp_imovel'>
											<option value='0'>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
%>
										  </select>
										  <%
set objRS = Nothing
%>
									  </font></span></div></td>
									  <td width="13%"><div align="right" class="style48"><font face="Verdana, Arial, Helvetica, sans-serif"><span class="style50">
										  <select  name="desc_aluguel" size="1" class="style51" id="desc_aluguel">
											<option value="0" selected>Selecione</option>
											<option value="Aluguel">Aluguel</option>
											<option value="Venda">Venda</option>
										  </select>
									  </span></font></div></td>
									  <td width="19%"><div align="right" class="style48"><strong><font face="Verdana, Arial, Helvetica, sans-serif">
										<label><span class="style2"><font face="Verdana, Arial, Helvetica, sans-serif">Ref.:</font></span><strong><font face="Verdana, Arial, Helvetica, sans-serif">
										  <% 

strQ = "SELECT * FROM imovel WHERE referencia = 'referencia' AND ativo = '1'" 
strQ = "SELECT * FROM imovel WHERE referencia IS NOT NULL"
Set objRS = cn.Execute(strQ)

Response.Write "<SELECT  class='cx' NAME='referencia'>"
Response.Write " <option value='0'>Selecione</option>"

If Not objRS.EOF Then
  While Not objRS.EOF
	Response.Write "<OPTION VALUE='" & objRS("referencia") & "'"
	If Request("id_imovel") = objRS("referencia") Then Response.Write " selected"
	Response.Write ">" & objRS("referencia") & "</OPTION>"
	objRS.MoveNext
  Wend
End If

Response.Write "</SELECT>"

set objRS = Nothing
%>
										  </font></strong></label>
										  <!--% 
'if trim(referencia)<>"" and  referencia <> "0" then
'	strQ = "SELECT * FROM imovel WHERE referencia = '" & referencia & "' AND ativo = '1'"  'que você tentou fazer aqui? n&'atilde;o entendi....
'else
'	strQ = "SELECT * FROM imovel"
'end if


'Set objRS = cn.Execute(strQ)

'Response.Write "<SELECT  class='cx' NAME='referencia'>"
'Response.Write " <option value='0'>Selecione</option>"

'If Not objRS.EOF Then
'  While Not objRS.EOF
'	Response.Write "<OPTION VALUE='" & objRS("referencia") & "'"
'	If Request("id_imovel") = objRS("referencia") Then Response.Write " selected"
'	Response.Write ">" & objRS("referencia") & "</OPTION>"
'	objRS.MoveNext
'  Wend
'End If

'Response.Write "</SELECT>"

'set objRS = Nothing
%-->
									  </font></strong></div></td>
									  <td width="16%" height="23"><div align="right" class="style48"><span class="style2"><font face="Verdana, Arial, Helvetica, sans-serif">
										  <select name="valor_minimo" size="1" class="style51">
											<option value="1">Valor Mínimo</option>
											<option value="1">R$ 0</option>
											<option value="500">R$ 500.00</option>
											<option value="1000">R$ 1.000,00</option>
											<option value="1500">R$ 1.500,00</option>
											<option value="2000">R$ 2.000,00</option>
											<option value="2500">R$ 2.500,00</option>
											<option value="3000">R$ 3.000,00</option>
											<option value="3500">R$ 3.500,00</option>
											<option value="4000">R$ 4.000,00</option>
											<option value="4500">R$ 4.500,00</option>
											<option value="5000">R$ 5.000,00</option>
											<option value="10000">R$ 10.000</option>
											<option value="15000">R$ 15.000</option>
											<option value="20000">R$ 20.000</option>
											<option value="25000">R$ 25.000</option>
											<option value="30000">R$ 30.000</option>
											<option value="35000">R$ 35.000</option>
											<option value="40000">R$ 40.000</option>
											<option value="45000">R$ 45.000</option>
											<option value="50000">R$ 50.000</option>
											<option value="55000">R$ 55.000</option>
											<option value="60000">R$ 60.000</option>
											<option value="65000">R$ 65.000</option>
											<option value="70000">R$ 70.000</option>
										  </select>
									  </font></span></div></td>
									  <td width="19%"><font face="Verdana, Arial, Helvetica, sans-serif"><font face="Verdana, Arial, Helvetica, sans-serif">
										<select size="1" name="valor_maximo" class="cx">
										  <option value="9999999">Valor Máximo</option>
										  <option value="500">R$ 500,00</option>
										  <option value="1000">R$ 1.000,00</option>
										  <option value="1500">R$ 1.500,00</option>
										  <option value="2000">R$ 2.000,00</option>
										  <option value="2500">R$ 2.500,00</option>
										  <option value="3000">R$ 3.000,00</option>
										  <option value="3500">R$ 3.500,00</option>
										  <option value="4000">R$ 4.000,00</option>
										  <option value="4500">R$ 4.500,00</option>
										  <option value="5000">R$ 5.000,00</option>
										  <option value="10000">R$ 10.000</option>
										  <option value="20000">R$ 20.000</option>
										  <option value="30000">R$ 30.000</option>
										  <option value="40000">R$ 40.000</option>
										  <option value="50000">R$ 50.000</option>
										  <option value="60000">R$ 60.000</option>
										  <option value="70000">R$ 70.000</option>
										  <option value="80000">R$ 80.000</option>
										  <option value="90000">R$ 90.000</option>
										  <option value="100000">R$ 100.000</option>
										  <option value="120000">R$ 120.000</option>
										  <option value="140000">R$ 140.000</option>
										  <option value="160000">R$ 160.000</option>
										  <option value="180000">R$ 180.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></font></td>
									  <td width="10%"><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>
									</table></TD>
							  </TR>
							</TABLE>
						</div>
							<div align="center"></div></td>
					  </tr>
					  <tr>
						<td height="36" valign="top"><table width="700" border="0" align="center" cellpadding="0" cellspacing="0">
							<tr>
							  <td height="300" valign="top" bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="0" cellpadding="0">
								  <tr bgcolor="#FFFFFF">
									<td valign="top"><div align="center"><span class="style31"><br>
									  Resultado da Busca </span><br>
									</div>
									  <table width="700" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
	<td height="207" valign="top" bgcolor="#FFFFFF"><div align="center"><font face="Comic Sans MS"> </font>
	  <table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
			  <tr>
				<td><table width="98%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#F7F7F7">
					<tr>
					  <td><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#0000CC">
						  <tr>
							<td width="20%" height="22" class="cx"><div align="center" class="style47">Referência</div></td>
							<td width="22%" class="cx"><div align="center" class="style47">Bairro</div></td>
							<td width="16%" class="cx"><div align="center" class="style47">Dormitórios</div></td>
							<td width="17%" class="cx"><div align="center" class="style47">Vagas</div></td>
							<td width="25%" class="cx"><div align="center" class="style47">Preço</div></td>
						  </tr>
					  </table></td>
					</tr>
					<tr>
					  <td valign="top"><%									  
'If Trim( Request.Form("tp_imovel")) <> "0" AND Trim( Request.Form("desc_aluguel")) <>"0"  AND Trim( Request.Form ("referencia")) = "0" AND Trim( Request.Form("valor_minimo")) <> "0" AND Trim( Request.Form("valor_maximo")) <> "9999999" Then

'If Trim( Request.Form("tp_imovel")) <> "0" AND Trim( Request.Form("desc_aluguel")) = "0"  AND Trim( Request.Form ("referencia"))= "0" AND Trim( Request.Form("valor_minimo")) = "0" AND Trim( Request.Form("valor_maximo")) = "9999999" Then

'	comandosql = "SELECT * FROM imovel WHERE (((desc_aluguel) Like '*')) and ativo = '1' ORDER BY nivel_prioridade ASC"

'	comandosql = "SELECT * FROM imovel "

'	comandosql = comandosql & " Where desc_aluguel Like '%" & Request("desc_aluguel") & "%' AND ativo = '1'ORDER BY nivel_prioridade ASC"



tp_imovel = Request.form("tp_imovel")	
desc_aluguel = Request.form("desc_aluguel")
referencia = Request.form("referencia")
valor_minimo = Request.form("valor_minimo")
valor_maximo = Request.form("valor_maximo")

a=0
comandosql = "SELECT * FROM imovel and ativo = '1' ORDER BY nivel_prioridade ASC"
clausula=""
if tp_imovel<>"0" then
	if a=0 then 
		clausula = clausula & " where tp_imovel='"&tp_imovel&"'"
		a=a+1
	else
		clausula = clausula & " and tp_imovel='"&tp_imovel&"'"
	end if
end if

if desc_aluguel <> "0" then
	if a=0 then 
		clausula = clausula & " where desc_aluguel='"&desc_aluguel&"'"
		a=a+1
	else
		clausula = clausula & " and desc_aluguel='"&desc_aluguel&"'"
	end if
end if

if referencia <> "0" then
	if a=0 then 
		clausula = clausula & " where referencia='"&referencia&"'"
		a=a+1
	else
		clausula = clausula & " and referencia='"&referencia&"'"
	end if
end if


if valor_minimo <> "0" then
	if a=0 then 
		clausula = clausula & " where valor>="&valor_minimo&" and valor<="&valor_maximo
		a=a+1
	else
		clausula = clausula & " and valor>="&valor_minimo&" and valor<="&valor_maximo
	end if
end if

comandosql = comandosql & clausula

if tp_imovel = "0" and desc_aluguel = "0" and referencia = "0" and valor_minimo = "0" and valor_maximo = "9999999"then
	
		clausula = clausula & " where valor='0' and desc_alugel='0' and referencia='0' and valor_minimo='0' and valor_maximo='9999999'"
	
end if

'response.write comandosql:response.end

'############################################################################
#######################
	Set conexao =  Server.CreateObject("ADODB.Connection")
	conexao.Open "DBQ=" & Server.MapPath("..\bd\bd.mdb") & ";Driver={Microsoft Access Driver (*.mdb)}"
[color="#FF0000"][b]	Set consulta = conexao.Execute(comandosql)[/b][/color]

'############################################################################
#######################

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

		if total > 0 then
		consulta.MoveFirst


	%>
						<table border="0" width="100%" cellspacing="1">
						  <%

	while not consulta.EOF

	n = consulta("id_imovel")
	%>
						  <tr>
							<td width="20%" height="20" bgcolor="#FFFFCC" class="style39"><div align="center" class="style36"><a href="ve_imovel.asp?id_imovel=<%=consulta("id_imovel")%>" style="text-decoration:none; color:#666666">
							  <% =consulta("referencia") %>
							  </a> </div></td>
							  <td width="22%" bgcolor="#FFFFCC" class="style39"><div align="center" class="style36"><a href="ve_imovel.asp?id_imovel=<%=consulta("id_imovel")%>" style="text-decoration:none; color:#666666">
								<% =consulta("bairro") %>
								</a></div></td>
							  <td width="16%" bgcolor="#FFFFCC" class="style39"><div align="center" class="style36">
								<% =consulta("dormitorios") %>
								</div></td>
							  <td width="17%" bgcolor="#FFFFCC" class="style39"><div align="center" class="style36">
								<% =consulta("vagas") %>
								</div></td>
							  <td bgcolor="#FFFFCC" class="style39"><div align="right" class="style36">
								<div align="center">
								  <% =FormatCurrency(consulta("valor")) %>
								  </div>
							  </div></td>
							</tr>
						  <%

	consulta.MoveNext
	WEnd

	%>
						  </table>
						<%
'	end if
	end if
	
	conexao.close
	Set conexao = Nothing

%>
						<%
'end if
'	end if
%>					  </td>
					</tr>
				</table></td>
			  </tr>
				</table>
	</div></td>
  </tr>
  <tr>
	<td height="10" valign="top" bgcolor="#FFFFFF"><div align="center"></div></td>
  </tr>
</table></td>
								  </tr>
							  </table></td>
							</tr>
						</table></td>
					  </tr>
					  <tr>
						<td height="19" valign="top"><table width="700" border="0" align="center" cellpadding="0" cellspacing="0">
							<tr>
							  <td bgcolor="#0059B3"><table width="90%" border="0" cellspacing="0" cellpadding="7" align="center">
								  <tr>
									<td class="textobr"><div align="center"><font color="#FFFFFF">Moradia Imobiliária 
									  - Tel.: (11) 2546.2299 – Fax: (11) 2943.2121 - contato@moradia.imb.br</font></div></td>
								  </tr>
							  </table></td>
							</tr>
						</table></td>
					  </tr>
				  </table></td>
				</tr>
			</table></td>
		  </tr>
	  </table></td>
	</tr>
  </table>
</form>
</body>
</html>

 

Alguem pode me ajudar ...

 

Valew http://forum.imasters.com.br/public/style_emoticons/default/thumbsup.gif

Compartilhar este post


Link para o post
Compartilhar em outros sites

antes da linha do erro manda escrever o valor da variavel comandosql e poste aqui

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.