Ir para conteúdo

POWERED BY:

Arquivado

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

clagils

alterar cadastro nao altera

Recommended Posts

ola pessoal

bele?

eu estou pressisando de uma ajudinha

espero q vcs possam me ajudar

 

 

aqui vai

 

 

 

eu fiz uma pagina de alteracao de cadastros

porem ela nao altera e nem retorna erros

 

oq podera estar errado

 

 

deem uma olhada

 

 

 

 

 

adm.asp

 

<%'nao armazenar no cacheResponse.Buffer=true Response.AddHeader "cache-control", "private" Response.AddHeader "pragma", "no-cache" Response.ExpiresAbsolute = #January 1, 1990 00:00:01# Response.Expires=Now()-1 Response.AddHeader "Cache-Control", "must-revalidate" Response.AddHeader "Cache-Control", "no-cache" Response.Addheader "Last-Modified:", Now() %><%If NOT Session("logado") = true ThenResponse.redirect("login.asp")Response.EndEnd If%><%dim acaoacao = Request("acao")acao = administrador%><%' funcao ______________administrador function administrador%><script language="JavaScript" type="text/JavaScript"><!--function MM_reloadPage(init) {  //reloads the window if Nav4 resized  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {	document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();}MM_reloadPage(true);//--></script><div id="Layer1" style="position:absolute; left:163px; top:7px; width:96px; height:31px; z-index:1">  <form name="form2" method="post" action="logout.asp">	<input name="logout" type="submit" id="logout" value="Logout">  </form></div><form action="adm.asp" method="get" enctype="multipart/form-data" name="form_1" target="_self" id="form_1">  <table width="179" height="134" border="0" cellpadding="0" cellspacing="0">	<tr align="center" valign="middle" bgcolor="#660000"> 	  <td height="29" colspan="2"><font color="#FFFFFF" size="+1">Administrador</font></td>	</tr>	<tr bgcolor="#CCCCCC"> 	  <td width="21" height="22" align="left" valign="middle" bgcolor="#660000"> 		<input type="radio" name="radiobutton" value="cadastro">	  </td>	  <td width="118" bgcolor="#FFCCCC">Cadastro</td>	</tr>	<tr bgcolor="#FFCCCC"> 	  <td height="23" align="left" valign="middle" bgcolor="#666666"> 		<input type="radio" name="radiobutton" value="consulta">	  </td>	  <td width="118" bgcolor="#CCCCCC">Consulta</td>	</tr>	<tr align="center" bgcolor="#666666"> 	  <td align="left" valign="middle" bgcolor="#339999"><input type="radio" name="radiobutton" value="altera">	  </td>	  <td align="left" bgcolor="#99CCCC">Alterar Cadastro</td>	</tr>	<tr align="center" bgcolor="#666666"> 	  <td colspan="2"> <input type="submit" name="Submit2" value="OK"> </td>	</tr>  </table>  <!--##########campo hidden#####-->  <input name="acao" type="hidden" value="administrador"> <!--#########campo hidden#####--></form><%if request("radiobutton")="cadastro" Thenresponse.write ("Cadastro<BR>")call cadastroelseif request("radiobutton")="consulta" Thenresponse.write ("Consulta<BR>")call consultaelseif request("radiobutton")="altera" Thenresponse.write ("Altera Cadastro<BR>")call alteraEnd ifEnd Function' fim funcao __________________________administrador%><%'######################%><%' funcao ___________________consultafunction consulta%><%'arquivo de consulta de cadastrodim cenecdim conexaodim gravaconec = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=Provider=Microsoft.Jet.OLEDB.4.0; Data Source="&Server.MapPath("login.mdb")Set conexao = Server.CreateObject("ADODB.Connection")conexao.Open conecSet grava=Server.CreateObject("ADODB.RecordSet")grava.Open  "SELECT * FROM usuario",conexao,3,3'se grava chegar ao final da lista entao..if grava.eof thenresponse.write "nao ha registros"Set grava = nothingSet conexao = nothingelse%><form action="deleta.asp" method="get" enctype="multipart/form-data" name="form_2" id="form_2">  <table width="524" height="18%" border="0" cellpadding="0" cellspacing="0" bordercolor="#CCCCCC">	<tr align="center"> 	  <td height="24%" colspan="5" bgcolor="#660000"><font color="#FFFFFF" size="+1">Consulta</font></td>	</tr>	<tr> 	  <td width="41" height="24%" bgcolor="#996633"><font color="#FFFFFF" size="+1">ID</font></td>	  <td width="136" bgcolor="#660000"><font color="#FFFFFF" size="+1">Nome</font></td>	  <td width="137" bgcolor="#666666"><font color="#FFFFFF" size="+1">Senha</font></td>	  <td width="152" bordercolor="#FFFFFF" bgcolor="#339999"><font color="#FFFFFF" size="+1">Página</font></td>	  <td width="58" bgcolor="#674523"><font color="#FFFFFF" size="+1">Excluir</font></td>	</tr>	<%intRec=0While intRec<grava.pagesize AND NOT grava.EOF%>	<tr> 	  <td height="24" align="left" valign="middle" bgcolor="#EAD5BF"><%=grava("id")%></td>	  <td bgcolor="#FFCCCC"><%=grava("nome")%> </td>	  <td bgcolor="#CCCCCC"><%=grava("senha")%> </td>	  <td bgcolor="#99CCCC"><%=grava("pagina")%> </td>	  <td align="left" valign="middle" bgcolor="#E3C8AC"> 		<input type="checkbox" name="checkbox" value=<%=grava("id")%>>	  </td>	</tr>	<tr> 	  <%grava.MovenextWendend ifSet grava = nothingSet conexao = nothing%>	  <td height="30%" colspan="4" bgcolor="#666666"> </td>	  <td align="left" valign="top" bgcolor="#666666"> 		<input name="submit" type="submit" id="submit" value="Excluir">	  </td>	</tr>  </table>  <!--############campo hidden###############-->  <input name="acao" type="hidden" value="consulta">  <!--###########campo hidden#####--></form><%End Function' fim de function ___________________consulta%><%'########################%><%' function _______cadastrofunction cadastro%><form action="cadastro.asp" method="get" enctype="multipart/form-data" name="form_3" id="form_3">  <table width="176" height="144" border="0" cellpadding="0" cellspacing="0">	<tr align="center"> 	  <td height="20" colspan="2" bgcolor="#660000"><font color="#FFFFFF" size="+1">Cadastro</font></td>	</tr>	<tr> 	  <td height="30" bgcolor="#660000"><font color="#FFFFFF" size="+1">Nome</font></td>	  <td align="right" valign="middle" bgcolor="#FFCCCC"> 		<input name="nome" type="text" id="nome" size="20" maxlength="20"> </td>	</tr>	<tr> 	  <td height="34" bgcolor="#666666"><font color="#FFFFFF" size="+1">Senha</font></td>	  <td align="right" valign="middle" bgcolor="#CCCCCC"> 		<input name="senha" type="password" id="senha" size="20" maxlength="20">	  </td>	</tr>	<tr align="right" bgcolor="#666666"> 	  <td height="31" align="left" bgcolor="#339999"><font color="#FFFFFF" size="+1">Pagina</font></td>	  <td align="right" valign="middle" bgcolor="#99CCCC"> 		<input name="pagina" type="text" id="pagina" value="" size="20" maxlength="20">	  </td>	</tr>	<tr align="right" bgcolor="#666666"> 	  <td colspan="2"> 		<input type="submit" name="Submit" value="Cadastrar"> 	  </td>	</tr>  </table>  <!--#######campo hidden###############-->  <input name="acao" type="hidden" value="cadastra">  <!--#########campo hidden#######--></form><%End Function' fim de function ______cadastra%><%function altera'#'#'#'#_____________________________________________funcao altera'#'#'#'#'#'#'#'#'#'#' function ______________altera%><%'arquivo de consulta de cadastrodim cenecdim conexaodim gravaconec = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=Provider=Microsoft.Jet.OLEDB.4.0; Data Source="&Server.MapPath("login.mdb")Set conexao = Server.CreateObject("ADODB.Connection")conexao.Open conecSet grava=Server.CreateObject("ADODB.RecordSet")grava.Open  "SELECT * FROM usuario",conexao,3,3'se grava chegar ao final da lista entao..if grava.eof thenresponse.write "nao ha registros"Set grava = nothingSet conexao = nothingelse%><form action="altera.asp" method="get" enctype="multipart/form-data" name="form_4" id="form_4">  <table width="632" height="103" border="0" cellpadding="0" cellspacing="0" bordercolor="#CCCCCC">	<tr align="center"> 	  <td height="23" colspan="7" bgcolor="#660000"><font color="#FFFFFF" size="+1">Alterar 		Cadastrro </font></td>	</tr>	<tr> 	  <td width="20" height="23" bgcolor="#996633"><font color="#FFFFFF" size="+1">ID</font></td>	  <td width="133" bgcolor="#660000"><font color="#FFFFFF" size="+1">Nome</font></td>	  <td width="133" bgcolor="#666666"><font color="#FFFFFF" size="+1">Senha</font></td>	  <td width="133" bordercolor="#FFFFFF" bgcolor="#339999"><font color="#FFFFFF" size="+1">Página</font></td>	  <td width="111" bgcolor="#674523"><font color="#FFFFFF" size="+1">Desfazer</font></td>	  <td colspan="2" bgcolor="#993300"><font color="#FFFFFF" size="+1">Alterar</font></td>	</tr>	<%intRec=0While intRec<grava.pagesize AND NOT grava.EOF%>	<tr> 	  <td height="34" align="left" valign="middle" bgcolor="#EAD5BF"><%=grava("id")%></td>	  <td bgcolor="#FFCCCC"><input name="nome" type="text" id="nome" value=<%=grava("nome")%> size="20" maxlength="20"> 	  </td>	  <td bgcolor="#CCCCCC"><input name="senha" type="text" id="senha" value=<%=grava("senha")%> size="20" maxlength="20"> 	  </td>	  <td bgcolor="#99CCCC"><input name="pagina" type="text" id="pagina" value=<%=grava("pagina")%> size="20" maxlength="20"> 	  </td>	  <td align="left" valign="middle" bgcolor="#E3C8AC"> <input name="submit3" type="reset" id="submit32" value="Desfazer"> 	  </td>	  <td width="54" align="left" valign="middle" bgcolor="#FF9966"><input name="submit2" type="submit" id="submit28" value="Alterar"> 	  </td>	  <td width="35" align="left" valign="middle" bgcolor="#FF9B6A"> 		<input type="checkbox" name="checkbox2" value="checkbox">	  </td>	</tr>	<tr> 	  <%grava.MovenextWendend ifSet grava = nothingSet conexao = nothing%>	  <td height="23" colspan="7" bgcolor="#666666">  </td>	</tr>  </table>  <!--#######campo hidden###########-->  <input name="acao" type="hidden" value="altera">  <!--#########campo hidden</form><%end function'#'#'#'#_____________________________________________funcao altera'#'#'#'#'#'#'#'#'#'#%>

 

 

 

altera.asp

 

 

 

<%'nao armazenar no cacheResponse.Buffer=true Response.AddHeader "cache-control", "private" Response.AddHeader "pragma", "no-cache" Response.ExpiresAbsolute = #January 1, 1990 00:00:01# Response.Expires=Now()-1 Response.AddHeader "Cache-Control", "must-revalidate" Response.AddHeader "Cache-Control", "no-cache" Response.Addheader "Last-Modified:", Now() %><%dim conecdim conexaodim sqldim gravadim nomedim senhadim paginanome= replace(request.querystring("nome"), "'", "''")senha= replace(request.querystring("senha"), "'", "''")pagina= replace(request.querystring("pagina"), "'", "''")'obj de conexao oleconec = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=Provider=Microsoft.Jet.OLEDB.4.0; Data Source="&Server.MapPath("login.mdb")'obj conexao bdset conexao = Server.CreateObject("ADODB.Connection")conexao.Open conec' obj gravacao bdset grava=Server.CreateObject("ADODB.RecordSet")'insere bdsql = "UPDATE DISTINCTROW usuario SET nome='"&nome&"', senha='"&senha&"' WHERE pagina='"&(pagina)&"'"' execulta as conexoesgrava.Open sql,conexao,1,3%><html><head><title>Documento sem título</title></head><body>   <%Set grava = nothingSet conexao = nothingresponse.redirect("adm.asp")%> </body></html>

 

caso possom me ajudar , desde ja agradeço

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.