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
Leer las respuestas