Jump to content
Fórum Script Brasil
  • 0

[resolvido] Erro Com Select!


Gustavo Moraes
 Share

Question

olá, estou tentando fazer um script de noticias, mas a pagina que vizualiza a noticia, esta dando erro nessa parte:

call abre_conexao
ID = request.querystring("ID")
Set rs=conexao.execute("SELECT * FROM tabela where ID =" & ID & " ORDER BY id DESC")
        id = rs("ID")
        titulo = rs("titulo")
        texto = rs("texto")
          descricao = texto %>

Mais precisamente na linha do select!!!

alguém tem uma dica?

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'ID ='.

/noticia.asp, line 13

As paginas q estou usando são as seguintes:

Index.asp

<!--#include file="conexao.asp"-->
<HTML>
<HEAD>
<TITLE>Leitura de registros de uma tabela</TITLE>
</HEAD>
<BODY>
<h1><div align="center">Leitura da tabla</div></h1>
<br>
<br>
<% 
call abre_conexao
Set rs=conexao.execute("select * from tabela")
titulo = rs("titulo")
link = "<a href='noticia.asp?id=" & id & "'>" & titulo & "</a>"
%>
<%
Do While Not RS.Eof
%>
<table align="center" border=1>
 <tr> 
    <td height="2" valign="top"><font face="Geneva, Arial, Helvetica, san-serif" size="1" class="home"> 
      <span class="home"> 
      <%=link%>
      </td>
</tr>
<%
RS.MoveNext
Loop

'Fechamos o sistema de conexão
Call fecha_conexao%>

</table>

<div align="center">
<a href="inserir.html">Acrescentar um novo registro</a><br>
<a href="atualizar1.asp">Atualizar um registro existente</a><br>
<a href="apagar1.asp">Apagar um registro</a><br>
</div>

</BODY>
</HTML>
noticia.asp
<!--#include file="conexao.asp"-->
<HTML>
<HEAD>
<TITLE>Ver a Notícia</TITLE>
</HEAD>
<BODY>
<h1><div align="center">Vendo a Notícia</div></h1>
<br>
<br>
<% 
call abre_conexao
ID = request.querystring("ID")
Set rs=conexao.execute("SELECT * FROM tabela where ID =" & ID & " ORDER BY id DESC")
        id = rs("ID")
        titulo = rs("titulo")
        texto = rs("texto")
          descricao = texto %>

<table border="1" cellpadding="4" cellspacing="0" width="450" bordercolor="#000000" align="center">
  <tr> 
      <td bgcolor="#FFCC00" align="center">
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr> 
            <td align="center"><strong><%=titulo%></strong></td>
          </tr>
</table>
 <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr> 
            <td> <%=descricao%> </td>
            </tr>
            </table>


               <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr> 
            <td align="center"><a href="java script:self.history.go(-1)"><b>voltar</b></a></td>
          </tr>
        </table>
</BODY>
</HTML>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



  • Forum Statistics

    • Total Topics
      150.2k
    • Total Posts
      647.4k
×
×
  • Create New...