Foros del Web » Programando para Internet » ASP Clásico »

Problema con Transaction=Required

Estas en el tema de Problema con Transaction=Required en el foro de ASP Clásico en Foros del Web. Hola! Vengo luchando hace varios dias con el 'OnTransactionAbort', ya que tengo algo que no he visto en ningun lugar... lo he buscado mucho y ...
  #1 (permalink)  
Antiguo 29/08/2007, 14:26
 
Fecha de Ingreso: abril-2007
Mensajes: 13
Antigüedad: 17 años, 1 mes
Puntos: 0
Exclamación Problema con Transaction=Required

Hola! Vengo luchando hace varios dias con el 'OnTransactionAbort', ya que tengo algo que no he visto en ningun lugar... lo he buscado mucho y no he encontrado nada que me lo pueda solucionar. Espero sepan ayudarme.

El codigo lo utilizo es el que muestro en el siguiente post (era muy largo para postearlo en uno solo)

El problema que tengo es que cuando la pruebo me queda en un ciclo infinito y no me levanta la pagina.. y sale "La transacción ha abortado por exceso de tiempo en su ejecución."
Cuando le saco el 'Transaction=Required' la pagina funciona bien nuevamente, pero no puedo capturar el error de que se quede ciclando infinitamente y mostrar el cartel de error.

La cosa es que uando pruebo la pagina sin las conecciones a base de datos y sin abrir las conexiones con excel me anda bien y puedo capturar el error.

Si alguien sabe por que pasa esto y tiene una solucion o me puede ayudar se lo agradeceria mucho!
  #2 (permalink)  
Antiguo 29/08/2007, 14:28
 
Fecha de Ingreso: abril-2007
Mensajes: 13
Antigüedad: 17 años, 1 mes
Puntos: 0
Re: Problema con Transaction=Required

Código:
<%@ Transaction=Required  LANGUAGE="VBScript" %>
<%
Sub OnTransactionAborted()
Response.Write "La transacción ha abortado por exceso de tiempo en su ejecución."
End Sub
%>	
<html>
<head>
<title>Carga del Reporte de Informe de Horas</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript">
 //(funciones para el formato de la ventana)
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" background="FondoSistema.jpg">
<%
'Componente que se instala cuando posee office instalado sino NO SIRVE
'Instanciamos y abrimos nuestro objeto conexion 
Dim DefConexionBDD
Set Conn = Server.CreateObject("ADODB.Connection") 
DefConexionBDD = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source="&Server.Mappath("RTS.MDB")
Conn.Open DefConexionBDD
%>
<form name="form1" method="get" action="ReporteInformeHoras.asp">
<%
if request("action") = "A base de Datos" then
	Path = Request.QueryString("file")
	Path_Check = RIGHT(Path, 4)
	if Path = "" or Path_Check <> ".xls" then
		err = true
	else
		err = false
		
		Set appExcel = Server.CreateObject("Excel.Application")
		Set wkb = appExcel.Workbooks.Open(Path)
		wkb.Sheets(1).activate
		Set sh = wkb.Sheets(1) 'para trabajar con sh y no con toda la ruta
		
		celda_empleado = sh.Cells(7,1)
		if celda_empleado <> "" then
			SQL_rec = "Select * from Recurso" ' carga la tabla Recurso
			Set RS_rec = Server.CreateObject("ADODB.RecordSet")
			RS_rec.open SQL_rec, Conn, 2, 2
			do while not RS_rec.eof
			    Ap = LCase(RS_rec("Apellidos"))
			    No = LCase(RS_rec("Nombres"))
			    Ap = Trim(Ap)
			    No = Trim(No)
			    Nomb = LCase(celda_empleado)
			    totcar = Len(Nomb)
				esp = Instr(Nomb, " ")
				Ape1 = Left(Nomb, esp)
				Ape2 = Right(Nomb, totcar-esp)
				Ape1 = Trim(Ape1)
				Ape2 = Trim(Ape2)
				Rec = RS_rec("CodigoRecurso")
				if StrComp(Ape1,Ap,1) = 0 or StrComp(Ape2,Ap,1) = 0 then
					emp = Rec
				end if
				RS_rec.movenext
			loop
			RS_rec.close
		end if
		cargarok = false
		set rs_check = CreateObject("ADODB.Recordset")
		SQL_check = "Select * from InformeHoras WHERE Empleado="&emp&" AND Semana="&CInt(sh.Cells(7,7).Value)
		rs_check.open SQL_check, Conn, 2, 2
		if not rs_check.eof then
			ide = rs_check("Identificador")
			%>
				<Script language="Vbscript">
				 	msg = msgbox("La Planilla de la Semana <%=sh.Cells(7,7).Value%> completada por <%=sh.Cells(7,1)%> ya ha sido cargada anteriormente, y su numero de Reporte es '<%=ide%>'. Seleccione otra Planilla.")
				</script>
			<%
		else
			cargarok = true
		end if
		rs_check.close
		if cargarok then
			Set Rs = Server.CreateObject("ADODB.RecordSet")
			Set Det = Server.CreateObject("ADODB.RecordSet")
			rs.ActiveConnection = Conn
			SQL = "Select * from InformeHoras"' carga la tabla InformeHoras
			rs.open SQL, Conn, 2, 2' abrimos el recordset y le añadimos el Conn, 2, 2 
		    if not rs.eof then
				rs.movelast 
				CodRep = rs("Identificador")
			else
				CodRep = 0
			end if
			'Carga del InformeHoras
			rs.addnew
			Aux = Cint(CodRep) + 1
			if aux < 10 then
				aux = "000"&Cstr(aux)
				elseif aux < 100 then
					aux = "00"&Cstr(aux)
					else
					aux = "0"&Cstr(aux)
			end if
			CodRep = Aux
			rs.fields("Identificador") = CodRep
			celda_division = sh.Cells(7,4)
			celda_division = LCase(celda_division)
			celda_division = Ltrim(celda_division)
			celda_division1 = celda_division
			celda_total = Len(celda_division1)
			celda_total = celda_total - 1
			celda_division1 = LEFT(celda_division1, celda_total)
			celda_division2 = celda_division&"s"
			if celda_division <> "" then
				SQL_area = "Select CodigoArea from Area where LCase(Nombre)='"&celda_division&"' OR LCase(Nombre)='"&celda_division1&"' OR LCase(Nombre)='"&celda_division2&"'"
				Set RS_area = Server.CreateObject("ADODB.RecordSet")
				RS_area.open SQL_area, Conn, 2, 2
				if not rs_area.eof then
					rs.fields("Division") = RS_area("CodigoArea")
				end if
				RS_area.close
			end if
			celda_empleado = sh.Cells(7,1)
			if celda_empleado <> "" then
				SQL_rec = "Select * from Recurso" ' carga la tabla Recurso
				Set RS_rec = Server.CreateObject("ADODB.RecordSet")
				RS_rec.open SQL_rec, Conn, 2, 2
				do while not RS_rec.eof
				    Ap = LCase(RS_rec("Apellidos"))
				    No = LCase(RS_rec("Nombres"))
				    Ap = Trim(Ap)
				    No = Trim(No)
				    Nomb = LCase(celda_empleado)
				    totcar = Len(Nomb)
					esp = Instr(Nomb, " ")
					Ape1 = Left(Nomb, esp)
					Ape2 = Right(Nomb, totcar-esp)
					Ape1 = Trim(Ape1)
					Ape2 = Trim(Ape2)
					Rec = RS_rec("CodigoRecurso")
					if StrComp(Ape1,Ap,1) = 0 or StrComp(Ape2,Ap,1) = 0 then
						rs.fields("Empleado") = Rec
						Response.Write "<input type='hidden' name='CRec' value="&Rec&">"
					end if
					RS_rec.movenext
				loop
				RS_rec.close
			end if
			if sh.Cells(7,7).Value <> "" then
				rs.fields("Semana") = sh.Cells(7,7).Value
			end if
			if sh.Cells(7,8) <> "" then
				rs.fields("FechaFinalizacion") = sh.Cells(7,8)
			end if
			if sh.Cells(27,6) <> "" then
				rs.fields("TotHorasNormales") = sh.Cells(27,6)
			end if
			rs.update ' que actualiza la base de datos
			rs.Close ' se cierra el registro que contiene los datos de InformeHoras
			set rs = nothing
			SQL_det = "Select * from DetalleInformeHrs" 'Carga la tabla de reporte DetalleInformeHoras
			Det.open SQL_det, Conn, 2, 2 'Abrimos el recordset
			dim cont
			'Carga del DetalleInformeHoras
			deta = false
			for cont = 9 to 26 'Comienza a recorrer las filas y a guardar la información recuperada en la BD
				guardar = false
				if sh.cells(cont,1) <> "" then 'Verifica si hay algo en la fila, para dar de alta en el DetalleInformeHoras
					guardar = true
					deta = true
				end if
				if guardar then
					Det.addnew' agregamos un nuevo registro
					on error resume next
					Det.fields("IdentificadorInfHoras") = CodRep
					Det.fields("Fecha") = sh.Cells(cont,1)
					if sh.Cells(cont,2) <> "" then
						Det.fields("HsNormales") = sh.Cells(cont,2)
					end if
					if sh.Cells(cont,3) <> "" then
						Det.fields("Hs50") = sh.cells(cont, 3)
					end if
					if sh.Cells(cont,4) <> "" then
						Det.fields("Hs100") = sh.cells(cont, 4)
					end if
					if sh.Cells(cont,5) <> "" then
						Det.fields("HsViaje") = sh.cells(cont, 5)
					end if
					if sh.Cells(cont,6) <> "" then
						Det.fields("TotalHsNormales") = sh.cells(cont, 6)
					end if
					if sh.Cells(cont,7).Value <> "" then
						Det.fields("NroInfServicio") = sh.cells(cont, 7).Value
					end if
					if sh.Cells(cont,8) <> "" then
						Det.fields("Proyecto") = sh.cells(cont, 8)
					end if
					Det.update ' que actualiza la base de datos
					ok = true
				end if
			next
			Det.close ' se cierra el registro que contiene los datos de DetalleInformeHoras
			set Det = nothing
		end if
		wkb.Close() ' cierro el objeto
		appExcel.Application.Quit()
		appExcel.Quit()
	end if
end if
if ok and deta then
	%>
		<script language="vbscript">
			msg = msgbox("Nuevo Informe de Horas con Detalles dado de Alta")
		</script>
	<%
end if
if ok and deta = false then
	%>
		<script language="vbscript">
			msg = msgbox("Nuevo Informe de Horas dado de Alta, no contenia ningun Detalle")
		</script>
	<%
end if
%>
 
(SIGUE HTML Y ERRORES)
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 17:32.