Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

Carlos Souza

O que fazer?

Recommended Posts

Aparece o erro na função

 

Tipo de erro:

Microsoft OLE DB Provider for ODBC Drivers (0x80004005)

[Microsoft][Driver ODBC para Microsoft Access] A operação deve usar uma consulta atualizável.

/teste/index.asp, line 42

 

A linha 42 é a função Set bd = Conexao.Execute(ComandoSQL)

 

 

O codigo da pagina é:

[list=1]
[*]<html>
[*]<head>
[*]<title>ASP Dataform</title>
[*]</head>
[*]<body>
[*]<center><font face="Arial" size="4"><b>Formulário de Inclusão</b></h2></center>
[*]<%
[*]If IsEmpty( Request.Form("submit") ) Then
[*]%>
[*]<form method=post action="<%=Request.ServerVariables("script_name")%>">
[*]<table border=0 width="80%" align=center>
[*]  <tr>
[*]	<td align=right valign=top><font face="Arial" size="2">noticia1:</font></td>
[*]	<td align=left valign=top>
[*]	  <font face="Arial" size="2">
[*]	<input type=text name="noticia1" value="" size=15 maxlength=50 style="{<font-family:Arial; font-size:12}">
[*]	</td>
[*]  </tr>
[*]  <tr>
[*]	<td align=right valign=top><font face="Arial" size="2">noticia2:</font></td>
[*]	<td align=left valign=top>
[*]	  <font face="Arial" size="2">
[*]	<input type=text name="noticia2" value="" size=15 maxlength=50 style="{<font-family:Arial; font-size:12}">
[*]	</td>
[*]  </tr>
[*]  </font>
[*]</table>
[*]<center><input type=submit name=submit value=Incluir style="{<font-family:Arial; font-size:12}"></center>
[*]</form>
[*]<%
[*]Else
[*]  If Not IsEmpty(Request.Form("submit")) AND Trim(Request.Form("noticia1")) <> ""  AND Trim(Request.Form("noticia2")) <> ""  Then
[*]	Set Conexao = Server.CreateObject("ADODB.Connection")
[*]	Conexao.Open "DBQ=C:\Inetpub\wwwroot\teste\dados.mdb;Driver={Microsoft Access Driver (*.mdb)};"
[*]	ComandoSQL = "INSERT INTO noticia (noticia1, noticia2)"
[*]	ComandoSQL = ComandoSQL & " VALUES ("
[*]	ComandoSQL = ComandoSQL & "'" & Server.HTMLEncode(Request.FORM("noticia1")) & "',"
[*]	ComandoSQL = ComandoSQL & "'" & Server.HTMLEncode(Request.FORM("noticia2")) & "')"
[*]	Set bd = Conexao.Execute(ComandoSQL)
[*]	Conexao.Close
[*]	Set bd = Nothing
[*]	Set Conexao = Nothing
[*]%>
[*]   <font face="Arial" size="2">
[*]   <center><br>Os dados foram enviados com sucesso!
[*]   <br><a href="index.asp"><b>Clique aqui</b></a> para continuar</font></center>
[*]<%
[*]  Else
[*]%>
[*]   <font face="Arial" size="2">
[*]   <center><br>Atenção: Alguns dados necessário não foram preenchidos corretamente
[*]   <br><a href="java script:history.go(1)"><b>Clique aqui</b></a> para voltar</font></center>
[*]<%
[*]  End If
[*]End If
[*]%>
[*]</body>
[*]</html>
[/list]

Me ajudem...valew...

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.