Update: ASP + Access

Asked

Viewed 48 times

0

I am trying to update an ACCESS table on my website, only it displays this error:

Microsoft Access Database Engine error '80040e14'

Syntax error (missing operator) in query expression '[nome] ='.

/rh/func_update.asp, line 14

The code is this:

varnumero = Request.QueryString("num")

sql = "UPDATE funcionarios SET [ativo]='NAO' where [chapa] ="&varnumero&" ; "

set bd = Conexao.execute(sql) **linha 14 é essa**

'Response.Write(sql)

'Response.End

 response.Redirect("funcionarios.asp")
  • @Lidiane_fernandes try so in the line of your SELECT : sql = "UPDATE funcionarios SET [ativo]='NAO' where [chapa] ='" & varnumero &"'"

  • @Edvaldolucena bom dia Edvaldo, thanks for helping, gave this message here now Microsoft Access Database Engine error '80040e07' Data type Mismatch in criteria Expression. /Rh/func_update.Asp, line 14

  • Another error, however in the same line that was already showing error ... The test title varnumero = Request.QueryString("num") response.write (varnumero) and comment the rest of the code and check if the variable is loading some value.

  • @Edvaldolucena it brings the value yes, I was trying to update the code 41 and brought in the url, in case it is loading the value, right?

  • your code in thesis is updating a record and in sequence is redirecting to another page, it would be interesting for you to validate if really your variable varnumero has some value.

  • can post page code in full ?

Show 1 more comment

1 answer

0

Edvaldo, desculpa a demora, o código é esse abaixo

<HTML>
<!--#include file="connect.asp"-->
<HEAD>
<TITLE>..:: Funcionarios ::..</TITLE>
<BASE target="_top">
<LINK REL=stylesheet HREF="\heva.css" TYPE="text/css">
<META http-equiv="refresh" content="180">

</HEAD><center><TR align=center>
          <TD valign=top width=695 align=middle class="style6">
                <IMG border=0 src="rh4.png" 
                    style="height: 124px; width: 957px; text-align: center;"><br />
                </DIV>
             </DIV></DIV></TD>
          </TR>
</center>      

<script>     
function enviar(nome)
{   

    var num;
    num = 'func_update.asp?num='+nome; 

    window.navigate(num);

}
</script>    
<%

varnumero = Request.querystring("numero")

Set bd  = Server.CreateObject("ADODB.Recordset")
set bd  = conexao.execute("SELECT * FROM funcionarios WHERE ATIVO='SIM' and ano>=2000 order by secao asc,nome ")
'Response.Write(sql)
'Response.End

Session.LCID = 1046

%>
<BODY>
<center/>

<INPUT type=hidden name="ComandoSQL" value="<%=ComandoSQL%>">
<INPUT type=hidden name="Conexao" value="<%=Constr%>">

<TABLE border=1 bordercolor="darkgreen" style="width: 960px; margin-left: 0px">
  <TR bgcolor=green>
    <TD align="center"><B style=color:"white">SETOR</B></TD>
    <TD align="center"><B style=color:"white">NOME</B></TD>
    <TD align="center"><B style=color:"white">CARGO</B></TD>
    <TD align="center"><B style=color:"white">EXCLUIR</B></TD>
   </TR>

<% while not bd.eof %>
   <TR>
    <TD><B><%=bd("secao")%>&nbsp;</B></TD>
    <TD><B><%=bd("nome")%>&nbsp;</B></TD>
    <TD><B><%=bd("cargo")%>&nbsp;</B></TD>
    <td align="center" ><input class="style5" type="button" value="Excluir" 
                  onclick="window.location.href=('func_update.asp?<%=bd("chapa")%>');" /></td>   

</td>

</TR>

<%
bd.movenext
wend

Conexao.Close
Set bd = Nothing
Set Conexao = Nothing
%>
</TABLE>
        <hR>

        <P align=center>
            <A href="javascript:history.back();">
                <B>
                    Voltar
                </B>
            </A>
        </P>
</BODY>
</HTML>
  • managed to solve the problem ?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.