Jump to content


Photo

Erro No Meu Cód(update)


  • Faça o login para participar
1 reply to this topic

#1 rodrigoalves96

rodrigoalves96

    Novato no fórum

  • Usuários
  • 6 posts
  • Sexo:Não informado

Posted 18/06/2004, 00:27

Olá a todos!

Estou tentando atualizar os dados de uma tabela e está dando um erro xxxxxx no id. Quem puder me ajudar, pode me dizer onde que estou errando.
O erro está nessa xxxxxx de ID..ele diz que está faltando um operador(não é aspas que eu já tentei!)

<%
Option Explicit
Response.Expires = 0
Dim objConn, objRs, strQuery, strConnection,StringSQL, nome , telefone  , email , texto , autoid,id



  'Conectando com o banco de dados bcocadastro.mdb
Set objConn =  Server.CreateObject("ADODB.Connection")
objConn.Open "DBQ=" & Server.MapPath("db/bcocadastro.mdb") & ";Driver={Microsoft Access Driver (*.mdb)}","username","password"

StringSql = "Select * From cls_cadastro  where id =" & autoid
Set objRs = ObjConn.execute(StringSql)

if not objRs.Eof  then
id = request("autoid")
nome = trim(request.form("nome"))
telefone = trim(request.form("telefone"))
email = trim(request.form("email"))
texto = trim(request.form("texto"))

end if
objRs.close


%>


<html>

<head>
<meta http-equiv="Content-Language" content="pt-br">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>CADASTRO</title>
<link rel="stylesheet" type="text/css" href="estilo.css">
</head>

<body>

<form action="action_update.asp" method="post">
<table border="0" width="100%" cellpadding="2" class="tabela" >
<tr>
  <td colspan="2" height="52" bgcolor="#F2F2F2"><b><font class="titulo">
  Atualizar cadastro de Clientes:</font></b></td>
</tr>
<tr>
  <td width="9%" align="right"><font size="2">Nome:</font></td>
  <td width="89%"><input  type="text" name="nome" class="inputs" value='<%=objRS("nome")%>' ></td>
</tr>
<tr>
  <td width="9%" align="right"><font size="2">Telefone:</font></td>
  <td width="89%"><input type="text" name="telefone" class="inputs" value='<%=objRS("telefone")%>'></td>
</tr>
<tr>
  <td width="9%" align="right"><font size="2">E-mail:</font></td>
  <td width="89%"><input type="text" name="email" class="inputs" value='<%=objRS("email")%>'></td>
</tr>
<tr>
  <td width="9%" align="right"><font size="2">Digite aqui o texto:</font></td>
  <td width="89%"><textarea rows="3" name="texto" cols="46" class="inputs" value='<%=objRS("texto")%>'></textarea></td>
</tr>
<tr>
  <td width="98%" colspan="2"><input type="submit" name="Atualizar" value="Atualizar"></td>
</tr>
</table>
</form>


</body>

</html>



#2 cybermix

cybermix

    andrewsmedina.com.br

  • Ex-Admins
  • 3586 posts
  • Sexo:Não informado
  • Localidade:Não sou desse planeta não!!!!
  • Interesses:python, fireworks, linux, php, flash...

Posted 18/06/2004, 08:24

simples porque no seu codigo o valor do autoid esta vazio ate chegar na instrucao do sql.

pelo que percebi o autoid nao é uma variavel e sim o valor vindo de uma querystring ou formulario. se for isso mesmo :

em vez de

StringSql = "Select * From cls_cadastro  where id =" & autoid 

tente

StringSql = "Select * From cls_cadastro  where id =" & request("autoid ")

www.andrewsmedina.com.br




1 user(s) are reading this topic

0 membro(s), 1 visitante(s) e 0 membros anônimo(s)

IPB Skin By Virteq