Ir para conteúdo

POWERED BY:

Arquivado

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

amandita

SELECT nao está funcionando

Recommended Posts

Eu creio que só olhando essa parte do código talvez não dê para deduzir, mas enfim...

 

Esse select não está funcionando... Alguém - plz!!!!! - saberia me dizer pq??

 

<%If request.form("busca") <> "" then	Dim strsql		strsql = request.form("busca")		strsql = "SELECT obras.nome AS obra, autores.nome AS autor, emprestimos.disponivel AS disp, obras.cod_o AS codigo, "	strsql = strsql & " clientes.nome AS cliente "	strsql = strsql & " FROM (((obras INNER JOIN obra_autor ON obras.cod_o = obra_autor.cod_obra) "	strsql = strsql & " INNER JOIN autores ON obra_autor.cod_autor = autores.cod_a) "		strsql = strsql & " INNER JOIN emprestimos ON obras.cod_o = emprestimos.cod_obra) " 	strsql = strsql & " INNER JOIN clientes ON clientes.cod_c = emprestimos.cod_cliente "		If request.form("opt") = "0" then  strsql = strsql & " WHERE autores.nome LIKE '%" & strsearch & "%' "  strsql = strsql & " ORDER BY autores.nome "	Else  If request.form("opt") = "2" then  	strsql = strsql & " WHERE clientes.nome = '%" & strsearch & "%' "  	strsql = strsql & " ORDER BY clientes.nome "  Else   	strsql = strsql & " WHERE obras.nome LIKE '%" & strsearch & "%' "  	strsql = strsql & " ORDER BY obras.nome "  End If	End IfElseresponse.write ("buuuuuuuuuu")End If%>

Compartilhar este post


Link para o post
Compartilhar em outros sites

Oi MARCELO!!Bom o erro que aparece é o seguinte:"Tipo de erro:Microsoft JET Database Engine (0x80040E0C)O comando de texto não foi definido para o objeto de comando." :huh:

Compartilhar este post


Link para o post
Compartilhar em outros sites

bom... eu vou passar o código inteiro, ok?? (da página) pode ser que o erro esteja nela e nao exatamente do select...

 

qto ao response.write strsql, bom, deu "buuuuuuuuuuuuuuuu" (o "else" da condição)

 

<!--#include file="abre_bco.asp"--><%If request.form("busca") <> "" then	Dim strsearch		strsearch = request.form("busca")		strsql = "SELECT obras.nome AS obra, autores.nome AS autor, emprestimos.disponivel AS disp, obras.cod_o AS codigo, "	strsql = strsql & " clientes.nome AS cliente "	strsql = strsql & " FROM (((obras INNER JOIN obra_autor ON obras.cod_o = obra_autor.cod_obra) "	strsql = strsql & " INNER JOIN autores ON obra_autor.cod_autor = autores.cod_a) "		strsql = strsql & " INNER JOIN emprestimos ON obras.cod_o = emprestimos.cod_obra) " 	strsql = strsql & " INNER JOIN clientes ON clientes.cod_c = emprestimos.cod_cliente "		If request.form("opt") = "0" then  strsql = strsql & " WHERE autores.nome LIKE '%" & strsearch & "%' "  strsql = strsql & " ORDER BY autores.nome "	Else  If request.form("opt") = "2" then 	 strsql = strsql & " WHERE clientes.nome = '%" & strsearch & "%' " 	 strsql = strsql & " ORDER BY clientes.nome "  Else  	 strsql = strsql & " WHERE obras.nome LIKE '%" & strsearch & "%' " 	 strsql = strsql & " ORDER BY obras.nome "  End If	End If		consulta = true	Elseresponse.write ("buuuuuuuuuu")End If%><html><head>	<title>A Biblioteca</title>		<link rel="stylesheet" href="um.css">	<script language="JavaScript">  function popup(Code){ 	 window.open('bco_popup.asp?cod_o='+Code, 'popup', 'resizable=no, scrollbars=no, width=380, height=340, top=25, left=25')  }		</script></head><body class="bg"><table bgcolor="#ffffff" align="center" width="80%" height="95%" cellspacing=0  border=28 bordercolor="White">	<tr height="30">  <td colspan="2"> </td>	</tr>	<tr width="100%" valign="top">  <td colspan="2"> 	 <table width="100%">    <tr>   	 <th>      <p align="left"><img src="livros.jpg" align="right"><font class="fundo">A Biblioteca</font><br><font style="margin: 61px;" class="fundo2">Pesquisa</font></p>   	 </th>    </tr> 	 </table>  </td>	</tr>	<tr width="100%">  <td class="bsc" colspan="1" width="60%"> 	 Faça a sua busca: 	 <P> 	 <form name="frm" method="post" action="calling_bco.asp">    <input type="text" name="busca" maxlength="20">    <p>    <input type="radio" name="opt" value="0" id="at">  <font class="bsc">Por Autor</font>    <p>    <input type="radio" name="opt" value="1" id="ob" checked="yes" style="list-style-type: square;">  <font class="bsc">Por Título</font>    <p>    <input type="radio" name="opt" value="2" id="cl">  <font class="bsc">Por Cliente</font>    <p>    <input type="submit" name="envia" value="Buscar"> 	 </form>  </td>  <td class="bsc" colspan="1" valign="top" width="40%"> 	 Outras ações: 	 <P> 	 <ul class="dft_list"> 	 <li><!--#include file="bco_link_cad.html"--> 	 <li><!--#include file="bco_link_emp.html"--> 	 </ul>  </td>	</tr>	<tr width="100%">  <td colspan="2"> 	 <%	 	 SET rsLista = conn.execute (strsql)   	  	 If consulta then    If rsLista.EOF Then   	 Response.Write "<table width=""60%""><tr><td class=tbl2> Cadastro não encontrado!</td></tr></table>"    Else 	 %>      <table border="0" cellspacing="4">     	 <tr>        <td align="left" class="tbl"> <b>Obra</b></td>        <td align="left" class="tbl"> <b>Autor</b></td>        <td align="left" class="tbl"> <b>Status</b></td>     	 </tr>     	 <%While rsLista.EOF = false %>        <tr>       	 <td align="left" class="tbl2"> <%=rsLista("obra")%> </td>       	 <td align="left" class="tbl2"> <%=rsLista("autor")%> </td>       	 <td align="left" class="tbl2">           <!--include file="bco_rsNomCli.asp"-->                    <%          If rsLista("disp") = true then                   	 response.write ("<a class=""disp"" href=""bco_emp.asp""><b>Disponível</b></a>")         	           Else                   	 response.write ("<a href=""JavaScript:popup("& rsLista("codigo") &")"" class=disp><b>Não disponível</b></a>")         	           End If          %>                   </td>        </tr>        <%rsLista.MoveNext     	 WEnd%>   	       </table>    <%	    End if     	 'Else     'If consultaCli = true then %>     	       <!--<table border="0" cellspacing="4">     	 <tr>        <td align="left" class="tbl"> <b>Cliente</b></td>        <td align="left" class="tbl"> <b>Retém alguma obra?</b></td>     	 </tr>     	 <'%While rsLista.EOF = false %>     	 <tr>        <td align="left" class="tbl2"> <%=rsLista("cliente")%> </td>        <td align="left" class="tbl2">                	 <'%        	 If rsLista("disp") = true then                    response.write ("<b>Não</b>")                 	 Else       	           response.write ("<b>Sim</b>")                 	 End If       	 %>       	  </td>     	 </tr>        <'% rsLista.MoveNext     	 WEnd %>      </table>    	 <'%   	 Else      'If rsLista.EOF then     	 Response.Write "<table width=""60%""><tr><td class=tbl2> Cadastro não encontrado!</td></tr></table>"   	 '	End If -->    <%    'End If 	 End if 	  	 %>  </td>	</tr>	<!--#include file="bco_link_back.html"--></table></body></html><!--#include file="fecha_bco.asp"-->

a conexao com o banco está ok, pelo menos isso eu tenho certeza... hehehe

 

Obrigadauuum!

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.