Ir para conteúdo

POWERED BY:

Arquivado

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

Boris

[Resolvido] Colocar em Ordem

Recommended Posts

Galera estou com duvida no seguinte....

 

Estou com um sistea de busca que não consigo colocar em ordem ...

 

O erro é o seguinte:

Referência Bairro Dormitórios Vagas Preço

 

Microsoft OLE DB Provider for ODBC Drivers erro '80040e14'

 

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

 

buscar.asp, line 345

 

O codigo é o seguinte...

<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"><%

 

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 "

clausula=""

if tp_imovel<>"0" then

if a=0 then

clausula = clausula & " where tp_imovel='"&tp_imovel&"'and ativo = '1' ORDER BY nivel_prioridade ASC"

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 <> "" 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)}"

Set consulta = conexao.Execute(comandosql)'############################################################################

#######################

 

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>

não estou conseguindo está dando o seguinte erro

Alguem pode me ajudar

 

 

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

Compartilhar este post


Link para o post
Compartilhar em outros sites

Posta essa o resultado dessa linha

response.write comandosql:response.end

Compartilhar este post


Link para o post
Compartilhar em outros sites

Ai Hargon valew pela força...

 

Já consegui resolver.

 

Ai está o codigo

<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"><%

 

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 "

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 <> "" then

if a=0 then

clausula = clausula & " where valor>="&valor_minimo&" and valor<="&valor_maximo&" and ativo = '1' ORDER BY nivel_prioridade ASC"

a=a+1

else

clausula = clausula & " and valor>="&valor_minimo&" and valor<="&valor_maximo&" and ativo = '1' ORDER BY nivel_prioridade ASC"

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)}"

Set consulta = conexao.Execute(comandosql)

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

 

 

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>

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.