Ir para conteúdo

POWERED BY:

Arquivado

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

Nall Pinheiro

Erro no código ASP

Recommended Posts

Microsoft JET Database Engine error '80004005'

 

Operation must use an updateable query.

 

/news/adm/noticias.asp, line 124

 

alguém pode me ajudar com esse erro? não sei se essas informações são suficientes:

 

olha a página completa aí.

 

+++++++++++++++++++++++++++++++++++++++++++++++

 

<%@Language="VBScript"%>

<%

if Session("Administrador")="" then response.redirect("default.asp")

%>

<!--#include file="../scripts/abrebanco.asp"-->

<%

Function Formatar(var)

dim i,nw,l

nw=""

for i=1 to len(var)

l=mid(var,i,1)

select case l

case "["

l = "<b>"

case "]"

l = "</b>"

case "{"

l = "<i>"

case "}"

l = "</i>"

end select

nw = nw & l

next

formatar = nw

end function

 

if request("id")="gravar" then

set objUpload = server.CreateObject("Dundas.Upload.2")

objUpload.Save server.mappath("/img/arquivos")

For Each objUploadedFile in objUpload.Files

If InStr(1,objUploadedFile.ContentType,"octet-stream") Then

objUploadedFile.Delete

End If

Arquivo=objUploadedFile.Path

Next

if len(Arquivo)>10 then

vArquivo=split(Arquivo,"\")

Session("NomeArquivo")=vArquivo(ubound(vArquivo))

else

Session("NomeArquivo")=""

end if

For Each objFormItem In objUpload.Form

Session(objFormItem)=objFormItem.Value

Next

Set objUpload = Nothing

session("id")="gravar"

response.redirect("noticias.asp")

 

elseif session("id")="gravar" then

 

'REDIMENSIONAMENTO DA IMAGEM

if len(trim(Session("NomeArquivo")))>1 then

Set Jpeg = Server.CreateObject("Persits.Jpeg")

Path = server.mappath("/img/arquivos")&"\"&Session("NomeArquivo")

Jpeg.Open Path

 

Largura=Jpeg.OriginalWidth

Altura=Jpeg.OriginalHeight

 

if Largura>110 then

LarguraNova=110

AlturaNova=(LarguraNova*Altura)/Largura

Altura=AlturaNova

Largura=LarguraNova

end if

 

if Altura>110 then

AlturaNova=110

LarguraNova=(Largura*AlturaNova)/Altura

Altura=AlturaNova

Largura=LarguraNova

end if

 

Jpeg.Width = Largura

Jpeg.Height = Altura

Jpeg.Sharpen 1, 150

session("imgP")="pq_"&Session("NomeArquivo")

Jpeg.Save server.mappath("/img/arquivos")&"\"&session("imgP")

set Jpeg=nothing

end if

 

sSQL="Insert into Noticias "

sSQL=sSQL&"(TituloNoticia,ChamadaNoticia,"

if len(Session("NomeArquivo"))>10 then sSQL=sSQL&"LegendaFotoNoticia,FotoNoticia,TumbNoticia,"

sSQL=sSQL&"TextoNoticia) "

sSQL=sSQL&"values ('"&Session("Titulo")&"','"&session("Chamada")&"',"

if len(Session("NomeArquivo"))>10 then sSQL=sSQL&"'"&session("Legenda")&"','"&Session("NomeArquivo")&"','"&session("imgP")&"',"

sSQL=sSQL&"'"&session("Integra")&"');"

set RS=Conn.execute(sSQL)

set RS=nothing

session("id")=""

response.redirect("noticias.asp?pag="&session("pag"))

 

elseif request("id")="gravaralteracao" then

set objUpload = server.CreateObject("Dundas.Upload.2")

objUpload.Save server.mappath("/img/arquivos")

For Each objUploadedFile in objUpload.Files

If InStr(1,objUploadedFile.ContentType,"octet-stream") Then

objUploadedFile.Delete

End If

Arquivo=objUploadedFile.Path

Next

if len(Arquivo)>10 then

vArquivo=split(Arquivo,"\")

Session("NomeArquivo")=vArquivo(ubound(vArquivo))

else

Session("NomeArquivo")=""

end if

For Each objFormItem In objUpload.Form

Session(objFormItem)=objFormItem.Value

Next

Set objUpload = Nothing

session("id")="gravaralteracao"

response.redirect("noticias.asp")

 

elseif session("id")="gravaralteracao" then

sSQL="Update Noticias "

sSQL=sSQL&"set TituloNoticia='"&session("Titulo")&"'"

sSQL=sSQL&",ChamadaNoticia='"&session("Chamada")&"'"

if len(Session("NomeArquivo"))>10 then sSQL=sSQL&",FotoNoticia='"&Session("NomeArquivo")&"'"

sSQL=sSQL&",LegendaFotoNoticia='"&session("Legenda")&"'"

sSQL=sSQL&",TextoNoticia='"&session("Integra")&"' "

sSQL=sSQL&"where CodigoNoticia="&session("Cod")&";"

set RS=Conn.execute(sSQL)

set RS=nothing

response.redirect("noticias.asp?pag="&session("pag"))

 

elseif request("id")="gravarexclusao" then

Codigo=request("cod")

sSQL="Delete from Noticias "

sSQL=sSQL&"where CodigoNoticia="&Codigo&";"

' response.write sSQL

set RS=Conn.execute(sSQL)

set RS=nothing

response.redirect("noticias.asp?pag="&request("pag"))

end if

%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML>

<HEAD>

<TITLE>COBRAPOL</TITLE>

<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">

<META content="Microsoft FrontPage 4.0" name=GENERATOR>

<link href="../stilo_foco.css" rel="stylesheet" type="text/css">

<script language="JavaScript" type="text/JavaScript">

<!--

 

function MM_goToURL() { //v3.0

var i, args=MM_goToURL.arguments; document.MM_returnValue = false;

for (i=0; i<(args.length-1); i+=2) eval(args+".location='"+args[i+1]+"'");

}

function ValidarCriar(){ //Diogo Corazolla

if (document.FCobrapol.Titulo.value==""){

alert("Preencher o campo Título")

return document.FCobrapol.Titulo.focus();

}

if (document.FCobrapol.Chamada.value==""){

alert("Preencher o campo Chamada")

return document.FCobrapol.Chamada.focus();

}

if (document.FCobrapol.Integra.value==""){

alert("Preencher o campo Íntegra")

return document.FCobrapol.Integra.focus();

}

if (document.FCobrapol.File.value!=""){

alert("Por favor aguarde o envio da Foto")

}

document.FCobrapol.submit();

}

function ValidarAlterar(){ //Diogo Corazolla

if (document.FCobrapol.Senha2.value!=document.FCobrapol.Senha.value){

alert("Senha não confere")

return document.FCobrapol.Senha2.focus();

}

document.FCobrapol.submit();

}

//-->

</script>

</HEAD>

<BODY

leftMargin=0 topMargin=0 marginwidth="0" marginheight="0">

<div id="TOP" style="position:absolute; left:0px; top:147px; width:777px; height:23px; z-index:8; visibility: visible;">

<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFCC66">

<tr>

<td height="22"><table width="743" border="0" align="center" cellpadding="0" cellspacing="0">

<tr>

<td><div align="center">

<%

if session("criar")=True then

%><a href="administradores.asp">ADMINISTRADORES</a>

|

<%

end if

%><a href="noticias.asp">ÚLTIMAS NOTÍCIAS</a> |

<a href="eventos.asp">EVENTOS</a> | <a href="procurados.asp">PROCURADOS</a> | <a href="propostas.asp">PROPOSTAS</a> | <a href="logoff.asp">LOGOFF</a></div></td>

</tr>

</table></td>

</tr>

</table>

</div>

<TABLE cellSpacing=0 cellPadding=0 width=778 border=0>

<TBODY>

<TR>

<TD height="1" bgcolor="#FFFFFF"></TD>

</TR>

<TR>

<TD><TABLE WIDTH=778 BORDER=0 CELLPADDING=0 CELLSPACING=0>

<TR>

<TD> <img src="../img/logoanimada.gif" width="105" height="117"></TD>

<TD> <img src="../img/TOP_02.gif" width="378" height="117"></TD>

<TD> <IMG SRC="../img/TOP_03.jpg" WIDTH=149 HEIGHT=117 ALT=""></TD>

<TD> <IMG SRC="../img/TOP_04.jpg" WIDTH=146 HEIGHT=117 ALT=""></TD>

</TR>

<TR>

<TD> <IMG SRC="../img/TOP_05.jpg" WIDTH=105 HEIGHT=51 ALT=""></TD>

<TD> <IMG SRC="../img/TOP_06.jpg" WIDTH=378 HEIGHT=51 ALT=""></TD>

<TD> <IMG SRC="../img/TOP_07.jpg" WIDTH=149 HEIGHT=51 ALT=""></TD>

<TD> <IMG SRC="../img/TOP_08.jpg" WIDTH=146 HEIGHT=51 ALT=""></TD>

</TR>

</TABLE> </TD>

</TR>

<TR>

<TD bgColor=#ffffff> <TABLE cellSpacing=0 cellPadding=0 width=778 border=0>

<TBODY>

<TR>

 

<TD bgColor=#000000 height=22> <div align="center"><strong><font color="#FFFFFF">ADMINISTRADOR</font></strong></div></TD>

</TR>

</TBODY>

</TABLE></TD>

</TR>

<TR>

<TD> <TABLE cellSpacing=0 cellPadding=0 width=778 border=0>

<TBODY>

<TR>

<TD width=13 bgColor=#000000><IMG height=1

src="../img/PIXEL.GIF" width=13></TD>

<TD vAlign=top><IMG height=1

src="../img/PIXEL.GIF" width=155></TD>

<TD width=16 bgColor=#000000><IMG height=1

src="../img/PIXEL.GIF" width=13></TD>

</TR>

<TR>

<TD vAlign=top width=13 bgColor=#000000> </TD>

<TD height="200" vAlign=top bgColor=#ffffff><table width="100%" border="0" cellspacing="1" cellpadding="1">

<tr>

<td><strong>ÚLTIMAS NOTÍCIAS</strong></td>

</tr>

<tr>

<td><p>

<%

Set RS=Server.CreateObject("ADODB.Recordset")

RS.CursorLocation=2

RS.CursorType=3

RS.PageSize=10

Set RS.ActiveConnection=Conn

sSQL="Select * from Noticias order by CodigoNoticia desc"

RS.Open sSQL

 

If RS.EOF then

%>

</p>

<p> </p>

<p align="center"><b><font color="#990000" size="1" face="Verdana, Arial, Helvetica, sans-serif">Nenhum

registro encontrado.</font></b></p>

<%

else

pag=request("pag")

if pag="" then pag=1

totalRec = RS.RecordCount

inicio = (pag - 1) * RS.PageSize + 1

If cInt(pag) = cInt(RS.PageCount) then

fim = RS.RecordCount

else

fim = inicio + RS.PageSize - 1

End If

%>

<p align="center"><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b><font color="#FF0000"><%=totalRec%></font></b></font><font face="Verdana, Arial, Helvetica, sans-serif" size="2">

encontrado(s) - mostrando de <b><font color="#FF0000"><%=inicio%></font></b>

a<font color="#FF0000"> <b><%=fim%></b></font>.</font>

</p>

<table width="550" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#000000">

<%

Codigo=request("cod")

if Codigo="" then Codigo=0

' set RS=Conn.execute(sSQL)

RS.MoveFirst

intPageCount = cInt(RS.PageCount)

RS.AbsolutePage = pag 'intPage

For intRecord = 1 to RS.PageSize

if RS.EOF then exit for

if CInt(Codigo)=RS("CodigoNoticia") then

bgcolor="#FFCC66"

else

bgcolor="#FFFFFF"

end if

%>

<tr bgcolor="<%=bgcolor%>">

<td><strong><em><%=RS("TituloNoticia")%><br>

</em></strong><%=RS("ChamadaNoticia")%></td>

<td width="20" bgcolor="#FFFFFF"><div align="center"><a href="noticias.asp?id=alterar&cod=<%=RS("CodigoNoticia")%>&pag=<%=pag%>"><img src="../img/Ico_Editar.gif" width="17" height="17" border="0"></a></div></td>

<td width="20" bgcolor="#FFFFFF"><div align="center"><a href="noticias.asp?id=excluir&cod=<%=RS("CodigoNoticia")%>"><img src="../img/Ico_Excluir.gif" width="17" height="17" border="0"></a></div></td>

</tr>

<%

RS.MoveNext

Next

RS.Close

set RS=nothing

%>

</table>

 

<div align="center">

<%

foo = cInt(pag)

loo = cInt(IntPageCount)

antPage = pag - 1

if antPage < 1 then

%>

<font color="#999999" size="2" face="Verdana, Arial, Helvetica, sans-serif"><<</font>

<%

else

%>

<font size="2" face="Verdana, Arial, Helvetica, sans-serif"><a href="noticias.asp?pag=<%=antPage%>"><<</a></font>

<%

end if

for i=1 to loo

if CInt(i)=CInt(pag) then

response.write "<font size=""2"" face=""Verdana, Arial, Helvetica, sans-serif"" color=""000000""><b>" & i & "</b></font>"

else

response.write "<font size=""2"" face=""Verdana, Arial, Helvetica, sans-serif""><a href=""noticias.asp?pag=" & i & """>" & i & "</a></font>"

end if

if not i = loo then response.write " | "

next

if foo = loo then

%>

<font color="#999999" size="2" face="Verdana, Arial, Helvetica, sans-serif">>></font>

<%

else

%>

<a href="noticias.asp?pag=<%=pag+1%>"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">>></font></a>

<%

end if

%>

<%

end if

%>

</div>

 

</td>

</tr>

<tr>

<td><hr width="50%" size="1"></td>

</tr>

<tr>

<td>

<%

if request("id")="" then

%>

<form action="noticias.asp?id=gravar" method="post" enctype="multipart/form-data" name="FCobrapol" id="FCobrapol">

<div align="center"><strong>CADASTRAR</strong> </div>

<table width="550" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#000000">

<tr bgcolor="#FFFFFF">

<td colspan="2" valign="top"><div align="center">[<strong>negrito</strong>]

- {<em>itálico</em>} - [{<em><strong>nerito

e itálico</strong></em>}]</div></td>

</tr>

<tr bgcolor="#FFFFFF">

<td width="92" valign="top"><div align="right">Título:</div></td>

<td width="451"><textarea name="Titulo" cols="80" rows="2" id="Titulo"></textarea></td>

</tr>

<tr bgcolor="#FFFFFF">

<td valign="top"><div align="right">Chamada:</div></td>

<td><textarea name="Chamada" cols="80" rows="3" id="Chamada"></textarea></td>

</tr>

<tr bgcolor="#FFFFFF">

<td valign="top"><div align="right">Íntegra:</div></td>

<td><textarea name="Integra" cols="80" rows="20" id="textarea2"></textarea></td>

</tr>

<tr bgcolor="#FFFFFF">

<td valign="top"><div align="right">Foto:</div></td>

<td><input name="File" type="file" id="File" size="60"></td>

</tr>

<tr bgcolor="#FFFFFF">

<td><div align="right">Legenda:</div></td>

<td><textarea name="Legenda" cols="80" rows="2" id="textarea3"></textarea></td>

</tr>

<tr bgcolor="#FFFFFF">

<td colspan="2"><div align="center">

<input type="button" name="Button" value="Cadastrar" OnClick="ValidarCriar();">

</div></td>

</tr>

</table>

</form>

<%

end if

if request("id")="alterar" then

sSQL="Select * from Noticias where CodigoNoticia="&Codigo

set RS=Conn.Execute(sSQL)

Titulo=RS("TituloNoticia")

Chamada=RS("ChamadaNoticia")

Integra=RS("TextoNoticia")

Foto=RS("FotoNoticia")

Legenda=RS("LegendaFotoNoticia")

RS.Close

Set RS=nothing

%>

<form action="noticias.asp?id=gravaralteracao" method="post" enctype="multipart/form-data" name="FCobrapol" id="FCobrapol">

<div align="center"><strong>ALTERAR</strong></div>

<table width="550" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#000000">

<tr bgcolor="#FFFFFF">

<td colspan="2" valign="top"><div align="center">[<strong>negrito</strong>]

- {<em>itálico</em>} - [{<em><strong>nerito

e itálico</strong></em>}]</div>

</td>

</tr>

<tr bgcolor="#FFFFFF">

<td width="92" valign="top"><div align="right">Título:</div></td>

<td width="451"><textarea name="Titulo" cols="80" rows="2" id="textarea4"><%=Titulo%></textarea></td>

</tr>

<tr bgcolor="#FFFFFF">

<td valign="top"><div align="right">Chamada:</div></td>

<td><textarea name="Chamada" cols="80" rows="3" id="textarea5"><%=Chamada%></textarea></td>

</tr>

<tr bgcolor="#FFFFFF">

<td valign="top"><div align="right">Íntegra:</div></td>

<td><textarea name="Integra" cols="80" rows="20" id="textarea6"><%=Integra%></textarea></td>

</tr>

<tr bgcolor="#FFFFFF">

<td valign="top"><div align="right">Foto:</div></td>

<td><%

if not Foto="" then

%><img src="../img/arquivos/<%=Foto%>" width="251" height="188">

<br>

<%

end if

%>

<input name="File" type="file" id="File" size="60"></td>

</tr>

<tr bgcolor="#FFFFFF">

<td><div align="right">Legenda:</div></td>

<td><textarea name="Legenda" cols="80" rows="2" id="textarea7"><%=Legenda%></textarea></td>

</tr>

<tr bgcolor="#FFFFFF">

<td colspan="2"><div align="center">

<table width="100%" border="0" cellspacing="0" cellpadding="0">

<tr>

<td width="50%"><div align="center">

<input type="button" name="Button2" value="Alterar" onClick="ValidarCriar();">

<input name="cod" type="hidden" id="cod" value="<%=Codigo%>">

<input name="pag" type="hidden" id="cod4" value="<%=pag%>">

</div></td>

<td width="50%"><div align="center">

<input name="Button22" type="button" onClick="MM_goToURL('parent','noticias.asp');return document.MM_returnValue" value="Cancelar">

</div></td>

</tr>

</table>

</div></td>

</tr>

</table>

</form>

<%

end if

if request("id")="excluir" then

sSQL="Select * from Noticias where CodigoNoticia="&Codigo

set RS=Conn.Execute(sSQL)

Titulo=RS("TituloNoticia")

Chamada=RS("ChamadaNoticia")

RS.Close

Set RS=nothing

%>

<form action="noticias.asp" method="post" name="FCobrapol" id="FCobrapol">

<div align="center"><strong>EXCLUIR</strong></div>

<table width="550" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#000000">

<tr bgcolor="#FFFFFF">

<td colspan="2"><div align="left"><strong><font color="#990000">ATENÇÃO</font></strong></div></td>

</tr>

<tr bgcolor="#FFFFFF">

<td colspan="2"><div align="center">Deseja realmente

excluir a Notícia:<em><br>

<strong><%=Titulo%></strong></em><br>

<em><%=Chamada%></em>?</div></td>

</tr>

<tr bgcolor="#FFFFFF">

<td colspan="2"><div align="center">

<table width="100%" border="0" cellspacing="1" cellpadding="0">

<tr>

<td width="50%"><div align="center">

<input type="submit" name="Submit23" value="Excluir">

<input name="cod" type="hidden" id="cod3" value="<%=Codigo%>">

<input name="id" type="hidden" id="id" value="gravarexclusao">

<input name="pag" type="hidden" id="pag" value="<%=request("pag")%>">

</div></td>

<td width="50%"><div align="center">

<input name="Submit222" type="button" onClick="MM_goToURL('parent','noticias.asp');return document.MM_returnValue" value="Cancelar">

</div></td>

</tr>

</table>

</div></td>

</tr>

</table>

</form>

<%

end if

%>

</td>

</tr>

</table></TD>

<TD width=16 valign="top"

bgColor=#000000><p> </p></TD>

</TR>

</TBODY>

</TABLE></TD>

</TR>

</TBODY>

</TABLE>

<TABLE cellSpacing=0 cellPadding=0 width=778 border=0>

<TBODY>

<TR bgColor=#000000>

<TD align=middle height=1></TD>

</TR>

<TBODY>

<TR>

<TD height=35 align=middle bgColor=#000000>

<DIV align=center> <!-- <FONT

face="Verdana, Arial, Helvetica, sans-serif" color=#999999

size=1>© 2003</FONT><FONT

face="Verdana, Arial, Helvetica, sans-serif" size=1>- <A

href="http://www.tecnolink.com.br/"><FONT

color=#3f82c1>TecnoLink</FONT></A> <FONT color=#999999>Ltda. - Todos os

direitos reservados</FONT></FONT> --> </DIV>

</TD>

</TR>

</TBODY>

</TABLE>

</BODY></HTML>

<!--#include file="../scripts/fechabanco.asp"-->

 

+++++++++++++++++++++++++++++++++++++++++++++++++++

 

desde já agradeço a quem poder me ajudar.

Compartilhar este post


Link para o post
Compartilhar em outros sites

o erro é de permissão...verifica se o diretorio onde se encontra o db tem permissão de escrita...

Compartilhar este post


Link para o post
Compartilhar em outros sites

Pelo que eu vi, você tá usando o comando Request, mas não informou o método (Form, QueryString, Cookie...) Se você estiver trabalhando com formulários no método GET, use Request.QueryString, se for com o método POST, use Request.Form.

 

Talvez resolva.

Compartilhar este post


Link para o post
Compartilhar em outros sites

Pelo que eu vi, você tá usando o comando Request, mas não informou o método (Form, QueryString, Cookie...) Se você estiver trabalhando com formulários no método GET, use Request.QueryString, se for com o método POST, use Request.Form.

 

Talvez resolva.

não eh bem assim que funciona não...

 

o request varre todas as coleções de dados que você citou, só não lembro em que ordem...

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.