Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Galera, eu tenho o seguinte código abaixo, que eu preciso fazer consulta em duas tabelas: "contratos" e "cad_cheque". E está dando o seguinte erro:
[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'cod_contrato='.
/controle/entrada_cheques.asp, line 87
Segue o código:
<!--#include file="conexao.asp"-->
<!--#INCLUDE FILE = "config.inc" -->
<%
dim sessao
sessao = Request.QueryString("sessao")
Session("sessao") = sessao
strsql1="select * from usuario where codigo=" & Session("cod_usuario")
set rs1=Conn.execute(strsql1)
%>
<HTML>
<link href="estilo.css" rel="stylesheet" type="text/css" />
<STYLE type=text/css>
@import url("style.css");
</STYLE>
<style type="text/css">
<!--
body {
background-image: url(../base_rsvp/images/fundo_pagina.gif);
background-repeat: repeat;
}
-->
</style><style type="text/css">
<!--
body,td,th {
font-size: 9px;
}
-->
</style><HEAD>
<TITLE>Contratos Fechados</TITLE>
</script>
<style media="print">
.oculta
{
visibility: hidden
}
</style>
</script>
<%
Session.LCID = 1046
Session.TimeOut = 600
%>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
</HEAD>
<BODY>
<div align="center">
<div align="center"><img src="../base_rsvp/images/banner_painel.jpg" width="754" height="100">
<br />
<br>
<!--#INCLUDE FILE = "menu_drop.asp" -->
<br>
</div>
<table width="755" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="614" align="center" valign="top"><table width="754" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#666666" bgcolor="#663333">
<tr>
<td colspan="6" class="style4"><div align="center">..:: Controle de Cheques ::..</div></td>
</tr>
<tr>
<td width="42" height="16" class="style4"><div align="center">Cod.</div></td>
<td width="82" class="style4"><div align="center">Nº Cheque</div></td>
<td width="321" class="style4"><div align="center">Nome</div></td>
<td width="96" class="style4"><div align="center">Valor</div></td>
<td width="96" class="style4"><div align="center">Vencimento</div></td>
<td width="103" class="style4"><div align="center">Editar</div></td>
</tr>
</table>
<br>
<%Const TamanhoPagina = 20
set rsQuery = Server.CreateObject( "ADODB.RecordSet" )
rsQuery.PageSize = TamanhoPagina
rsQuery.CacheSize = TamanhoPagina
rsQuery.CursorType = 3
'rsQuery.Open"select * from cad_cheque order by cod_cheque desc", Conn
rsQuery.Open "select * from cad_cheque where cod_contrato="& cod2 &" order by vencimento", Conn
response.write(strsql2)
responde.end
if Session("PaginaAtual") = "" then Session("PaginaAtual") = 1
select case Request.QueryString( "modo" )
case "proxima"
Session("PaginaAtual") = min( Session("PaginaAtual") + 1, rsQuery.PageCount )
case "anterior"
Session("PaginaAtual") = max( Session("PaginaAtual") - 1, 1 )
case "pagina"
if isNumeric( request.QueryString("numero") ) then
Session("PaginaAtual") = cint( request.QueryString("numero") )
Session("PaginaAtual") = max( min( Session("PaginaAtual"), rsQuery.PageCount ), 1 )
end if
end select
rsQuery.AbsolutePage = Session("PaginaAtual")
cod_cheque=rsQuery("cod_cheque")
%>
<%
while not rs2.eof
cod2=rs2("cod_contrato")
%>
<%
rs2.movenext
wend
%>
<table width="754" border="1" align="center" cellpadding="1" cellspacing="0" bordercolor="#666666" bordercolorlight="<%= mainborderlight%>" bordercolordark="<%= mainborderdark%>">
<tr bordercolor="000000">
<%
item = 1
do while item <= TamanhoPagina and not rsQuery.eof
cod_cheque=rsQuery("cod_cheque") <td width="33" bordercolor="#666666" bgcolor="#663333" class="style4"><div align="center"><%=rsQuery("cod_cheque")%></div></td>
<td width="63" height="10" bordercolor="#666666" bgcolor="#663333" class="style4"><div align="center"><%=rsQuery("numero_cheque")%></div></td>
<td width="255" bordercolor="#666666" bgcolor="#663333" class="style4"> <%=rsQuery("contratante")%></td>
<td width="75" bordercolor="#666666" bgcolor="#663333" class="style4"><div align="right"><%=rsQuery("valor")%> </div></td>
<td width="75" bordercolor="#666666" bgcolor="#663333" class="style4"><div align="center"><%=rsQuery("vencimento")%></div></td>
<td width="27" bordercolor="#666666">
<div align="center"><a href="ver_cheque.asp?cod_cheque=<%=cod_cheque%>"><img src="../images/ico_visualizar.gif" title="visualizar cheque" alt="visualizar cheque" width="25" height="25" border="0"></a></div>
<div align="center"></div></td>
<td width="18">
<div align="center"><a href="imprimir_cheque.asp?cod_cheque=<%=cod_cheque%>" target="_blank"><img src="../images/ico_imprimir.gif" title="imprimir cheque" alt="imprimir cheque" width="25" height="24" border="0"></a> </div></td>
<td width="25" bordercolor="#999999">
<div align="center"><a href="visualizar_excluir_cheque.asp?cod_cheque=<%=cod_cheque%>"><img src="../images/ico_excluir.gif" title="excluir cheque" alt="excluir cheque" width="25" height="24" border="0"></a> </div></td>
<% rsQuery.Movenext
item = item + 1
n = n + 1
loop %>
<% next %>
</tr>
<% loop %>
</table>
<br>
<span class="style8">Há</span> <span class="style13"><%= rsQuery.RecordCount %></span> <span class="style8">cheques:</span> <br>
<span class="style8">Você está na página</span> <span class="style13"><%= Session("PaginaAtual") %></span>
<span class="style8">de</span> <span class="style13"><%= rsQuery.PageCount %></span><br>
<span class="style8">Ir para página:</span>
<span class="style13">
<%
if Session("PaginaAtual") > 1 then 'Colocar o link para página anterior se não for a primeira
response.write "<a href=""entrada_cheques.asp?cod="& cod &"&modo=anterior"">Anterior</a> "
end if
for n = 1 to rsQuery.pageCount
if n = Session("PaginaAtual") then
response.write n & " " ' Se for a página atual, não colocar link, só o número dela.
else
response.write "<a href=""entrada_cheques.asp?cod="& cod &"&modo=pagina&numero=" & n & """>" & n & "</a> "
end ifif Session("PaginaAtual") < rsQuery.pageCount then 'Colocar o link para próxima página se não for a última
response.write "<a href=""entrada_cheques.asp?cod="& cod &"&modo=proxima"">Próxima</a> "
end if
%>
</span></td>
</tr>
</table>
<div align="center"></div>
</body>
</html>function min( value1, value2 )
min = iif( value1 < value2, value1, value2 )
end function
function max( value1, value2 )
max = iif( value1 > value2, value1, value2 )
end function
%>
Essa é a linha 87: "rsQuery.Open "select * from cad_cheque where cod_contrato="& cod2 &" order by vencimento", Conn "
Alguém pode me ajudar !!
Carregando comentários...