
18/10/2007, 22:53
|
| | Fecha de Ingreso: octubre-2007
Mensajes: 191
Antigüedad: 17 años, 6 meses Puntos: 0 | |
Re: Mensaje de Alerta al ingresar datos Muchas Gracias amigos....me resulto....asi que les posteo el codigo....basicamente si el usuario ya existe, la pagina dos dirige mediante un response.write a existe.asp , donde aparece el mensaje de error y un boton que regresa hacia atras el historial.....y si se ingreso correctamente, manda un mensaje para saber que se ingreso correctamente...
pagina que procesa los datos Cita: <HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<FORM ACTION='Ingresar.asp' METHOD='GET' id=form1 name=form1>
</HEAD>
<%
if Session("id_usuario") = "" then
Response.Write "<SCRIPT LANGUAGE='JAVASCRIPT'>"
Response.Write "top.opener.close()"
Response.Write "</SCRIPT>"
Response.Redirect("Login.Asp")
end if
dim dbConn
usuarioconta=Session("id_usuario")
if Not IsEmpty(Request.Form("csr")) then
csr = replace(Request.Form("csr"), "'","" )
end if
if Not IsEmpty(Request.Form("loc")) then
loc = replace(Request.Form("loc"), "'","" )
end if
if Not IsEmpty(Request.Form("guia_d")) then
guia_d = replace(Request.Form("guia_d"), "'","" )
end if
if Not IsEmpty(Request.Form("distribuidor")) then
distribuidor = replace(Request.Form("distribuidor"), "'","" )
end if
if Not IsEmpty(Request.Form("fecha_in")) then
fecha_in = replace(Request.Form("fecha_in"), "'","" )
end If
if Not IsEmpty(Request.Form("artefacto")) then
artefacto = replace(Request.Form("artefacto"), "'","" )
end if
if Not IsEmpty(Request.Form("serie")) then
serie = replace(Request.Form("serie"), "'","" )
end If
if Not IsEmpty(Request.Form("estado")) then
estado = replace(Request.Form("estado"), "'","" )
end if
if Not IsEmpty(Request.Form("fecha_avi")) then
fecha_avi = replace(Request.Form("fecha_avi"), "'","" )
end if
if Not IsEmpty(Request.Form("fecha_ret")) then
fecha_ret = replace(Request.Form("fecha_ret"), "'","" )
end if
if Not IsEmpty(Request.Form("guia_sta")) then
guia_sta = replace(Request.Form("guia_sta"), "'","" )
end if
if Not IsEmpty(Request.Form("gtia")) then
gtia = replace(Request.Form("gtia"), "'","" )
end if
if Not IsEmpty(Request.Form("tecnico")) then
tecnico = replace(Request.Form("tecnico"), "'","" )
end if
if Not IsEmpty(Request.Form("cod_auto")) then
cod_auto = replace(Request.Form("cod_auto"), "'","" )
end if
On Error Resume next
Dim Rs, Cnn, strSQL,
set Cnn=Server.CreateObject("ADODB.Connection")
set rs=Server.CreateObject("ADODB.Recordset")
Cnn.Open Session("cnx")
strSQL = "select * from Tblcliente where csr='" & csr & "'"
rs.Open strSQL, Cnn, 1, 2
If Not rs.EOF then
' si el usuario ya existe, nos manda hacia existe.asp
Response.Write "<SCRIPT LANGUAGE='JAVASCRIPT'>"
Response.Write "window.close()"
Response.Write "</SCRIPT>"
Response.Redirect("../existe.asp")
else
' si se ingreso correctamente, inserta los datos y redirige a ingre_corre.asp
strSQL2 = "INSERT INTO Tblcliente (csr, loc, guia_d, distribuidor, fecha_in, artefacto, serie, estado, fecha_avi, fecha_ret, guia_sta, gtia, tecnico, cod_auto) VALUES ( '" & csr & "' , '" & loc & "' , '" & guia_d & "' , '" & distribuidor & "' , '" & fecha_in & "' ,'" & artefacto & "' , '" & serie & "' , '" & estado & "' , '" & fecha_avi & "' , '" & fecha_ret & "' , '" & guia_sta & "' , '" & gtia & "' , '" & tecnico & "' , '" & cod_auto & "' )"
' Response.Write strsql
cnn.Execute(strSQL2)
Response.Write "<SCRIPT LANGUAGE='JAVASCRIPT'>"
Response.Write "window.close()"
Response.Write "</SCRIPT>"
Response.Redirect("../ingre_corre.asp")
end if
Cnn.Close
set Cnn= nothing
set rs=Nothing
%>
<BODY>
</BODY>
</HTML> ingreso correcto: Cita: <%
if Session("id_usuario") = "" then
Response.Write "<SCRIPT LANGUAGE='JAVASCRIPT'>"
Response.Write "top.opener.close()"
Response.Write "</SCRIPT>"
Response.Redirect("Login.Asp")
end If %>
<font face="verdana">
<h2> <br> <br> <br>
<center>
Usuario Ingresado Exitosamente </h2>
<b>
<A href="menu.asp" target="_parent">Volver A Menu</A>
</b>
</font>
</center>
</BODY>
</HTML> si manda error porque ya existe, nos manda a existe.asp y un boton vuelve el historial hacia atras para revisar los datos e intentar nuevamente.... Cita: <HTML>
<HEAD>
</HEAD>
<body bgcolor="#FFCC66" background="2.jpg" text="white" link="white" vlink="white" alink="white">
<%
if Session("id_usuario") = "" then
Response.Write "<SCRIPT LANGUAGE='JAVASCRIPT'>"
Response.Write "top.opener.close()"
Response.Write "</SCRIPT>"
Response.Redirect("Login.Asp")
end If %>
<font face="verdana">
<h2> <br> <br> <br>
<center>
Usuario Ya existe, Verifique los Datos e Intente Nuevamente </h2>
<a href="JavaScript:history.back(1)">Volver a Ingresar </a>
</BODY>
</HTML> espero que les sirva y muchas gracias a todos por responder mis consultas, aunque aun me queda pendiente esta: http://www.forosdelweb.com/f15/busqu...7/#post2150172
por favor revisenla y si pueden....respondanme por favor !!! |