
09/11/2004, 14:18
|
| | Fecha de Ingreso: noviembre-2004 Ubicación: Medellin - Antioquia
Mensajes: 4
Antigüedad: 20 años, 6 meses Puntos: 0 | |
El codigo no se ejecuta normalmente, puesto que me realiza las validaciones antes de grabar, pero en el momento de guardar ya que me tiene que redireccionar la pagina a ella misma no es capas de hacerlo, solamente la carga y me saca el error en la barra de la ventana al lado del explorador.
<!--#include file="verificasesion.asp"-->
<!--#include file="sharedfunctions.asp"-->
<%strMensajeTran=""
intTipoTran=1
strNomPais=""
%>
<% if request.form("txtTipoTran")<>"" then
Set cn = CreateObject("ADODB.Connection")
cn.ConnectionString="DSN=" & Application("DBSource")
cn.Open
select case Request.Form("txtTipoTran")
case 1:
strTablaTemp=TempTable()
strSQL = "begin tran declare @nextcod as varchar(6) "
strSQL = strSQL & " create table " & strTablaTemp & " (c1 varchar(6)) "
strSQL = strSQL & "select @nextcod=(select max(str(codigop))+1 from paises) "
strSQL = strSQL & "if @nextcod is NULL set @nextcod='1' "
strSQL = strSQL & "insert into " & strTablaTemp & " values (@nextcod) "
strSQL = strSQL & "insert into paises values (@nextcod,'"
strSQL = strSQL & Request.Form("txtNomPais") & "') commit tran"
intTipoTran=2
case 2:
strSQL = "update paises set nombrep='"
strSQL = strSQL & Request.Form("txtNomPais") & "' where codigop='"
strSQL = strSQL & Request.Form("txtCodPais") & "'"
intTipoTran=2
case 3:
strSQL = "delete from paises where codigop='"
strSQL = strSQL & Request.Form("txtCodPais") & "'"
intTipoTran=1
case 4:
intTipoTran=2
end select
on error resume next
if Request.Form("txtTipoTran")<>4 then
cn.Execute(strSQL)
end if
if err then
strMensajeTran="Error: " & Err.Description
else
select case Request.Form("txtTipoTran")
case 1:
Set rs = CreateObject("ADODB.Recordset")
strSQL = "select c1 from " & strTablaTemp
rs.Open strSQL, cn
strCodPais=rs("c1")
cn.Execute "drop table " & strTablaTemp
rs.close
strNomPais=Request.Form("txtNomPais")
strMensajeTran="REGISTRO EDITABLE"
case 2:
strCodPais=Request.Form("txtCodPais")
strNomPais=Request.Form("txtNomPais")
strMensajeTran="REGISTRO EDITABLE"
case 3:
strMensajeTran="REGISTRO ELIMINADO"
case 4:
Set rs = CreateObject("ADODB.Recordset")
strSQL = "select nombrep from paises where codigop='" & Request.Form("txtCodPais") & "'"
rs.Open strSQL, cn
strCodPais=Request.Form("txtCodPais")
strNomPais=rs("nombrep")
strMensajeTran="REGISTRO EDITABLE"
rs.close
end select
end if
cn.Close
else
strMensajeTran="NUEVO REGISTRO"
end if
%>
<html>
<head>
<title>Prueba</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="css/cssAlfa1.css" type="text/css">
<link rel="stylesheet" href="css/cssAlfa2.css" type="text/css">
<script language="JavaScript">
<!--
function ValidarGrabacion() {
if (document.frmMantPaises.txtNomPais.value=="") {
alert("Debe digitar un nombre para el país.")
document.frmMantPaises.txtNomPais.focus();
}
else
document.frmMantPaises.submit();
}
function ValidarEliminacion() {
if (document.frmMantPaises.txtTipoTran.value==1) {
alert("No existe un registro para eliminar.")
document.frmMantPaises.txtNomPais.focus();
}
else {
if (confirm("Confirma que desea eliminar este país?")) {
document.frmMantPaises.txtTipoTran.value=3;
document.frmMantPaises.submit();
}
else
document.frmMantPaises.txtNomPais.focus();
}
}
//-->
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" background="images/fondo.gif" onLoad="document.frmMantPaises.txtNomPais.focus(); ">
<div align="left">
<p><img src="images/logoalfappal.gif" width="780" height="78"> </p>
<p align="center"><img src="images/mantpaises.gif" width="200" height="19"></p>
<!--#include file="toolbarmant.asp"-->
<table width="51%" border="0" align="center" class="cssAlfa2" bgcolor="#DCE7E7" height="80">
<tr>
<td height="70">
<div align="center">
<form name="frmMantPaises" method="post" action="<%=Request.QueryString("page")%>?page=<%=R equest.QueryString("page")%>">
<table width="375" border="0" height="49">
<tr>
<td width="53"><b><font face="Tahoma, Arial, sans-serif" size="2">País</font></b></td>
<td width="358"><b><font face="Tahoma, Arial, sans-serif" size="2">
<input name="txtNomPais" type="text" class="cssAlfa1" value="<%=strNomPais%>" size="50" maxlength="30">
<input type="hidden" name="txtTipoTran" value="<%=intTipoTran%>">
<input type="hidden" name="txtCodPais" value="<%=strCodPais%>">
</font></b></td>
</tr>
<tr>
<td colspan="2" height="2">
<div align="center"><font face="Tahoma, Arial, sans-serif" size="1" color="#000066"><%If len(strMensajeTran) > 30 then
Response.Write "<br>Imposible Borrar el Registro pues se encuentra asociado a otras tablas"
Else
Response.Write StrMensajeTran
End If%></font><font size="1" face="Tahoma, Arial, sans-serif"></font></div>
</td>
</tr>
</table>
</form>
</div>
</td>
</tr>
</table>
</div>
</body>
</html>
y me saca el siguiente error en la barra de titulo
http:/localhost/alfaora/mantpaises.asp?page=mantpaises.asp
Última edición por aracnido79; 09/11/2004 a las 15:01 |