Microsoft JET Database Engine error '80040e14'
Buenas pessoal,
Estou com uma dúvida num sistema que fiz.
É uma tela inicial de notícias, porem nele está aparecendo o seguinte erro:
>
Microsoft JET Database Engine error '80040e14'
Syntax error (missing operator) in query expression 'imagem <> '' and indice <>'.
/admin/noticias/site/ExibirHome.asp, line 113
O código destá página é:
<!-- #Include Virtual="/admin/comum/includes/conexao.asp"-->
<!-- #Include Virtual="/admin/comum/includes/parametros.asp"-->
<!-- #Include Virtual="/admin/comum/funcoes/asphtml.asp"-->
<%
Function HTMLEspeciais(sString)
If (sString <> "") Then
sString = Replace(sString, "á", "á")
sString = Replace(sString, "â", "â")
sString = Replace(sString, "Ã ", "à")
sString = Replace(sString, "ã", "ã")
sString = Replace(sString, "ç", "ç")
sString = Replace(sString, "é", "é")
sString = Replace(sString, "ê", "ê")
sString = Replace(sString, "Ã", "í")
sString = Replace(sString, "ó", "ó")
sString = Replace(sString, "ô", "ô")
sString = Replace(sString, "õ", "õ")
sString = Replace(sString, "ú", "ú")
sString = Replace(sString, "ü", "ü")
sString = Replace(sString, "Ã", "Á")
sString = Replace(sString, "Â", "Â")
sString = Replace(sString, "À", "À")
sString = Replace(sString, "Ã", "Ã")
sString = Replace(sString, "Ç", "Ç")
sString = Replace(sString, "É", "É")
sString = Replace(sString, "Ê", "Ê")
sString = Replace(sString, "Ã", "Í")
sString = Replace(sString, "Ó", "Ó")
sString = Replace(sString, "Ô", "Ô")
sString = Replace(sString, "Õ", "Õ")
sString = Replace(sString, "Ú", "Ú")
sString = Replace(sString, "Ü", "Ü")
sString = Replace(sString, """", """) '"
sString = Replace(sString, "<", "<") '<
sString = Replace(sString, ">", ">") '>
End If
HTMLEspeciais = sString
End Function
set Sql_Noticia = conn.execute("SELECT * FROM noticias WHERE imagem <> '' ORDER BY indice desc")
If not Sql_Noticia.eof And Not Sql_Noticia.bof Then
set Sql_Ttl = conn.execute("SELECT COUNT(indice) AS Ttl FROM noticias WHERE imagem <> ''")
sTtl = Sql_Ttl("Ttl")
If sTtl = 1 Then
sTtl = 1
ElseIf sTtl = 2 Then
sTtl = 2
Else
sTtl = 3
End If
i = 1
while not Sql_Noticia.eof And i < sTtl
sString = Sql_Noticia("titulo")
titulo = HTMLEspeciais(sString)
%>
<table width="100%">
<%
If i = 1 Then
idAnt = Sql_Noticia("indice")
%>
<tr>
<td height="160" align="center" bgcolor="#CCCCCC" colspan="3">
<a href="/admin/comum/upload/fotos/<%=Sql_Noticia("Imagem")%>" rel="lightbox" title="<%=titulo%>">
<img src="/admin/comum/upload/fotos/<%=Sql_Noticia("Imagem")%>" width="305" height="160">
</a>
</td>
</tr>
<tr>
<td align="left" height="30" colspan="3">
<a href="/monta.asp?link=exibirNoticia&qual=<%=Sql_Noticia("indice")%>"><font color="#03297E" size="2"><b><%=titulo%></b></font></a>
</td>
</tr>
<tr>
<td height="50" colspan="3">
<a href="/monta.asp?link=exibirNoticia&qual=<%=Sql_Noticia("indice")%>">
<%
If len(titulo) > 40 Then
sTexto = left(rtrim(ltrim(Sql_Noticia("resumo"))),40) & "..."
Else
sTexto = Sql_Noticia("resumo") & "..."
End If
sString = (sTexto)
texto = HTMLEspeciais(sString)
sCont = HTMLDecode(texto)
response.write sCont
%>
</a>
</td>
</tr>
<%
End If
i = i + 1
Sql_Noticia.movenext
Wend
%>
<tr><td height="5"></td></tr>
<tr><%
Set Sql_Noticia = Nothing
set Sql_Noticia = conn.execute("SELECT * FROM noticias WHERE imagem <> '' and indice <> " & idAnt & " ORDER BY indice desc")
j = 0
while not Sql_Noticia.eof And j < 2
sString = Sql_Noticia("titulo")
titulo = HTMLEspeciais(sString)%>
<td width="133" align="center" valign="top">
<table width="100%">
<tr>
<td height="70" align="center" bgcolor="#CCCCCC">
<a href="/admin/comum/upload/fotos/<%=Sql_Noticia("Imagem")%>" rel="lightbox" title="<%=titulo%>">
<img src="/admin/comum/upload/fotos/<%=Sql_Noticia("Imagem")%>" width="133" height="70">
</a>
</td>
</tr>
<tr>
<td align="left" height="30" colspan="3">
<a href="/monta.asp?link=exibirNoticia&qual=<%=Sql_Noticia("indice")%>"><font color="#03297E" size="1"><b><%=titulo%></b></font></a>
</td>
</tr>
<tr>
<td height="30">
<a href="/monta.asp?link=exibirNoticia&qual=<%=Sql_Noticia("indice")%>"><%
'If len(titulo) > 40 Then
' sTexto = left(rtrim(ltrim(Sql_Noticia("resumo"))),40) & "..."
'Else
sTexto = Sql_Noticia("resumo") & "..."
'End If
sString = (sTexto)
texto = HTMLEspeciais(sString)
sCont = HTMLDecode(texto)
response.write sCont
%>
</a>
</td>
</tr>
</table>
</td>
<td width="28"></td><%
j = j + 1
Sql_Noticia.movenext
Wend
%>
</tr>
</table><%
Else
%>
<tr>
<td height="200" align="center"><b><font color="red">Não há dados cadastrados.</font></b></td>
</tr>
<%
End If
Set Sql_Noticia = Nothing
%>
Teria como alguem me ajudar a resolver este probleminha?
Abs
Ah, o código da linha 113, onde diz no site que tem o erro é
set Sql_Noticia = conn.execute("SELECT * FROM noticias WHERE imagem <> '' and indice <> " & idAnt & " ORDER BY indice desc")
Discussão (14)
Carregando comentários...