Problema con Response.redirect()

11/10/2005 - 12:53 por Marc Llenas | Informe spam
Hola a todos,

Me esta sucediendo una cosa rarisima en una pagina asp. La pagina en
cuestion es llamada desde un formulario y se encarga de insertar varios
campos en dos tablas de una BBDD de Access. Despues de realizar las
inserciones, quiero que vuelva a la pagina del formulario para que el
usuario pueda realizar mas entradas. Para ello utilizo un vulgar
Response.redirect("request.asp") ... peroooooooo... me redirecciona a la
pagina principal index.asp.

El codigo es el siguiente:

<%@ LANGUAGE = VBScript %>
<!--#include file="DBConn.inc"-->
<!--#include file="DBConnAdd.inc"-->
<%
Dim sUser
Dim sPass
Dim bFlag

Dim intUserID
Dim intTypeID
Dim intYear
Dim intMonth
Dim intDay
Dim strQty

Session("ErrID") = 0

intUserID = request.form("txtUser")
intTypeID = request.form("CboType")
intYear = Mid(request.form("txtDate"),7,4) 'Year(request.form("txtDate"))
intMonth = Mid(request.form("txtDate"),4,2) 'Month(request.form("txtDate"))
intDay = Mid(request.form("txtDate"),1,2)'(Day(request.form("txtDate"))
strDetails = request.form("txtDetails")

'Check if there is any matches for the user and date and type 1, 6, 7 or 8
Set objRst= objConn.Execute("SELECT TblMain.MaiID, TblMain.MaiUserID,
TblMain.MaiYear, TblMain.MaiMonth, TblMain.MaiDay, TblMain.MaiType FROM
TblMain WHERE (((TblMain.MaiUserID)=" & intUserID & ") AND
((TblMain.MaiYear)=" & intYear & ") AND ((TblMain.MaiMonth)=" & intMonth &
") AND ((TblMain.MaiDay)=" & intDay & ") AND ((TblMain.MaiType)=1 Or
(TblMain.MaiType)=6 Or (TblMain.MaiType)=7 Or (TblMain.MaiType)=8));")

'If there are no matches insert entry
If objrst.eof= true then
Select Case intTypeID
Case 1 'Day of holidays
intTypeID = 11
intTypeIDReq = 1
Case 6 'Half day of holidays
intTypeID = 12
intTypeIDReq = 6
Case 7 'Half day off (allowed)
intTypeID = 13
intTypeIDReq = 7
Case 8 'Day off (allowed)
intTypeID = 14
intTypeIDReq = 8
End Select

strQty = "0"

Set objConn2 = Server.CreateObject("ADODB.Connection")
objConn2.ConnectionString = connString
objConn2.Properties("Jet OLEDB:Database Password") = "xxxxxxxxxx"
objConn2.Open()
objConn2.CursorLocation=3 'adUseClient

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

If isnull(strDetails) or strDetails = "" Then
strDetails = " "
End If

Set objRst2= objConn2.Execute("INSERT INTO TblPending ( PenUserID,
PeniYear, PenMonth, PenDay, PenQty, PenType, PenReason, PenDateReq ) SELECT
" & intUserID & " AS Expr1, " & intYear & " AS Expr2, " &intMonth & " AS
Expr3, " & intDay & " AS Expr4, '" & strQty & "' AS Expr5, " & intTypeID & "
AS Expr6, ' " & strDetails & "' AS Expr7, #" & Now() & "# AS Expr8;")
Set objRst2= objConn2.Execute("INSERT INTO TblMain ( MaiUserID, MaiYear,
MaiMonth, MaiDay, MaiQty, MaiType, MaiTypeRequested ) SELECT " & intUserID &
" AS Expr1, " & intYear & " AS Expr2, " & intMonth & " AS Expr3, " & intDay
& " AS Expr4, '" & strQty & "' AS Expr5, " & intTypeID & " AS Expr6, " &
intTypeIDReq & " AS Expr7;")

objConn2.Close

objRst.Close
objConn.Close

Response.redirect("request.asp")

End If

%>

Alguna idea?

Gracias.

Marc

Preguntas similare

Leer las respuestas

#1 Matías Iacono
11/10/2005 - 17:13 | Informe spam
No quiero pecar, pero esta correctamente escrita la pagina?

Haz probado hacer un redirect desde cualquier otra pagina para ver si va?.

Prueba de cambiar el nombre REQUEST por algun otro. Aunque no sea creible,
he tenido problemas con nombres de variables llamadas ID, como si ID
estubiera reservado.

Saludos.

Matías Iacono
Microsoft MVP ASP/ASP.net - DCE3
"Marc Llenas" escribió en el mensaje
news:dig5oe$poi$
Hola a todos,

Me esta sucediendo una cosa rarisima en una pagina asp. La pagina en
cuestion es llamada desde un formulario y se encarga de insertar varios
campos en dos tablas de una BBDD de Access. Despues de realizar las
inserciones, quiero que vuelva a la pagina del formulario para que el
usuario pueda realizar mas entradas. Para ello utilizo un vulgar
Response.redirect("request.asp") ... peroooooooo... me redirecciona a la
pagina principal index.asp.

El codigo es el siguiente:

<%@ LANGUAGE = VBScript %>
<!--#include file="DBConn.inc"-->
<!--#include file="DBConnAdd.inc"-->
<%
Dim sUser
Dim sPass
Dim bFlag

Dim intUserID
Dim intTypeID
Dim intYear
Dim intMonth
Dim intDay
Dim strQty

Session("ErrID") = 0

intUserID = request.form("txtUser")
intTypeID = request.form("CboType")
intYear = Mid(request.form("txtDate"),7,4) 'Year(request.form("txtDate"))
intMonth = Mid(request.form("txtDate"),4,2)
'Month(request.form("txtDate"))
intDay = Mid(request.form("txtDate"),1,2)'(Day(request.form("txtDate"))
strDetails = request.form("txtDetails")

'Check if there is any matches for the user and date and type 1, 6, 7 or 8
Set objRst= objConn.Execute("SELECT TblMain.MaiID, TblMain.MaiUserID,
TblMain.MaiYear, TblMain.MaiMonth, TblMain.MaiDay, TblMain.MaiType FROM
TblMain WHERE (((TblMain.MaiUserID)=" & intUserID & ") AND
((TblMain.MaiYear)=" & intYear & ") AND ((TblMain.MaiMonth)=" & intMonth &
") AND ((TblMain.MaiDay)=" & intDay & ") AND ((TblMain.MaiType)=1 Or
(TblMain.MaiType)=6 Or (TblMain.MaiType)=7 Or (TblMain.MaiType)=8));")

'If there are no matches insert entry
If objrst.eof= true then
Select Case intTypeID
Case 1 'Day of holidays
intTypeID = 11
intTypeIDReq = 1
Case 6 'Half day of holidays
intTypeID = 12
intTypeIDReq = 6
Case 7 'Half day off (allowed)
intTypeID = 13
intTypeIDReq = 7
Case 8 'Day off (allowed)
intTypeID = 14
intTypeIDReq = 8
End Select

strQty = "0"

Set objConn2 = Server.CreateObject("ADODB.Connection")
objConn2.ConnectionString = connString
objConn2.Properties("Jet OLEDB:Database Password") = "xxxxxxxxxx"
objConn2.Open()
objConn2.CursorLocation=3 'adUseClient

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

If isnull(strDetails) or strDetails = "" Then
strDetails = " "
End If

Set objRst2= objConn2.Execute("INSERT INTO TblPending ( PenUserID,
PeniYear, PenMonth, PenDay, PenQty, PenType, PenReason, PenDateReq )
SELECT " & intUserID & " AS Expr1, " & intYear & " AS Expr2, " &intMonth
& " AS Expr3, " & intDay & " AS Expr4, '" & strQty & "' AS Expr5, " &
intTypeID & " AS Expr6, ' " & strDetails & "' AS Expr7, #" & Now() & "# AS
Expr8;")
Set objRst2= objConn2.Execute("INSERT INTO TblMain ( MaiUserID, MaiYear,
MaiMonth, MaiDay, MaiQty, MaiType, MaiTypeRequested ) SELECT " & intUserID
& " AS Expr1, " & intYear & " AS Expr2, " & intMonth & " AS Expr3, " &
intDay & " AS Expr4, '" & strQty & "' AS Expr5, " & intTypeID & " AS
Expr6, " & intTypeIDReq & " AS Expr7;")

objConn2.Close

objRst.Close
objConn.Close

Response.redirect("request.asp")

End If

%>

Alguna idea?

Gracias.

Marc

Respuesta Responder a este mensaje
#2 bajopalabra
13/10/2005 - 18:20 | Informe spam
probá con una barra "/"

Response.redirect("/request.asp")

atte, Hernán

"Marc Llenas" escribió en el mensaje
news:dig5oe$poi$
Hola a todos,

Me esta sucediendo una cosa rarisima en una pagina asp. La pagina en
cuestion es llamada desde un formulario y se encarga de insertar varios
campos en dos tablas de una BBDD de Access. Despues de realizar las
inserciones, quiero que vuelva a la pagina del formulario para que el
usuario pueda realizar mas entradas. Para ello utilizo un vulgar
Response.redirect("request.asp") ... peroooooooo... me redirecciona a la
pagina principal index.asp.

El codigo es el siguiente:


<%@ LANGUAGE = VBScript %>
<!--#include file="DBConn.inc"-->
<!--#include file="DBConnAdd.inc"-->
<%
Dim sUser
Dim sPass
Dim bFlag

Dim intUserID
Dim intTypeID
Dim intYear
Dim intMonth
Dim intDay
Dim strQty

Session("ErrID") = 0

intUserID = request.form("txtUser")
intTypeID = request.form("CboType")
intYear = Mid(request.form("txtDate"),7,4) 'Year(request.form("txtDate"))
intMonth = Mid(request.form("txtDate"),4,2)


'Month(request.form("txtDate"))
intDay = Mid(request.form("txtDate"),1,2)'(Day(request.form("txtDate"))
strDetails = request.form("txtDetails")

'Check if there is any matches for the user and date and type 1, 6, 7 or


8
Set objRst= objConn.Execute("SELECT TblMain.MaiID, TblMain.MaiUserID,
TblMain.MaiYear, TblMain.MaiMonth, TblMain.MaiDay, TblMain.MaiType FROM
TblMain WHERE (((TblMain.MaiUserID)=" & intUserID & ") AND
((TblMain.MaiYear)=" & intYear & ") AND ((TblMain.MaiMonth)=" & intMonth &
") AND ((TblMain.MaiDay)=" & intDay & ") AND ((TblMain.MaiType)=1 Or
(TblMain.MaiType)=6 Or (TblMain.MaiType)=7 Or (TblMain.MaiType)=8));")

'If there are no matches insert entry
If objrst.eof= true then
Select Case intTypeID
Case 1 'Day of holidays
intTypeID = 11
intTypeIDReq = 1
Case 6 'Half day of holidays
intTypeID = 12
intTypeIDReq = 6
Case 7 'Half day off (allowed)
intTypeID = 13
intTypeIDReq = 7
Case 8 'Day off (allowed)
intTypeID = 14
intTypeIDReq = 8
End Select

strQty = "0"

Set objConn2 = Server.CreateObject("ADODB.Connection")
objConn2.ConnectionString = connString
objConn2.Properties("Jet OLEDB:Database Password") = "xxxxxxxxxx"
objConn2.Open()
objConn2.CursorLocation=3 'adUseClient

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

If isnull(strDetails) or strDetails = "" Then
strDetails = " "
End If

Set objRst2= objConn2.Execute("INSERT INTO TblPending ( PenUserID,
PeniYear, PenMonth, PenDay, PenQty, PenType, PenReason, PenDateReq )


SELECT
" & intUserID & " AS Expr1, " & intYear & " AS Expr2, " &intMonth & " AS
Expr3, " & intDay & " AS Expr4, '" & strQty & "' AS Expr5, " & intTypeID &


"
AS Expr6, ' " & strDetails & "' AS Expr7, #" & Now() & "# AS Expr8;")
Set objRst2= objConn2.Execute("INSERT INTO TblMain ( MaiUserID, MaiYear,
MaiMonth, MaiDay, MaiQty, MaiType, MaiTypeRequested ) SELECT " & intUserID


&
" AS Expr1, " & intYear & " AS Expr2, " & intMonth & " AS Expr3, " &


intDay
& " AS Expr4, '" & strQty & "' AS Expr5, " & intTypeID & " AS Expr6, " &
intTypeIDReq & " AS Expr7;")

objConn2.Close

objRst.Close
objConn.Close

Response.redirect("request.asp")

End If

%>


Alguna idea?

Gracias.

Marc


email Siga el debate Respuesta Responder a este mensaje
Ads by Google
Help Hacer una preguntaRespuesta Tengo una respuesta
Search Busqueda sugerida