Ver Mensaje Individual
  #33 (permalink)  
Antiguo 10/06/2010, 08:42
Avatar de JavierMMM
JavierMMM
 
Fecha de Ingreso: agosto-2008
Ubicación: Justito frente a la computadora.
Mensajes: 278
Antigüedad: 15 años, 8 meses
Puntos: 0
De acuerdo Respuesta: Consultar Campo Vacio de una BD

Antes que nada, muchas gracias por el interes y apoyo que me has dado estos días.... Una ves relajado, y tomando en cuenta los consejos dados por aquí, he llegado a la solución de mi problema (con las cachetadas mentales que me ha puesto un amigo jejejejejeje)

Resulta que todo lo que habiamos hecho hasta ahora estaba correcto, pero puesto en mi código de una manera tan complicada e inusual, que nada de lo que quería hubiera podido salir.

Te pongo el código de cómo ha quedado la solución:

Código HTML:
for i=1 to 28
	 if i=1 or i=2 or i=3 or i=5 or i=7 or i=8 or i=10 or i=13 or i=16 or i=17 or i=18 or i=19 then
		respEncontrada = false
		DBresp.open "Select A.Idpregunta, C.Pregunta From (Respuestas A left join Posrespuesta B on (A.Idpregunta = B.Idpregunta)) left join Preguntas C on (A.Idpregunta = C.Idpregunta) Where A.Idpregunta = "& i &" and C.Idpregunta = "& i &"  Group By A.Idpregunta, C.Pregunta", Con 
		if not DBresp.eof then
			response.write "<b>Reactivo " & DBresp("Idpregunta") & ": " & DBresp("Pregunta") & "</b><br />"
		end if
		DBresp.Close
		
		for j=1 to 3
			Rs.Open "Select A.Idpregunta as AR, C.Idpregunta as AP, B.Idpregunta as APR, B.Posrespuesta From ((Respuestas A left outer join Posrespuesta B on (A.Idpregunta = B.Idpregunta)) left outer join Preguntas C on (A.Idpregunta = C.Idpregunta)) left join Regcontestada D on (A.Idcont = D.Idcont) Where A.respuesta = '"& j &"' and  A.Idpregunta = "& i &" and B.Punpreg = '"& j &"' and C.Idpregunta = "& i &" and D.Carrera = '"& idinst &"' Group By  A.Idpregunta, C.Idpregunta, B.Idpregunta, B.Posrespuesta Order By B.Idpregunta", Con
			if Not Rs.EOF Then
				response.Write(Rs("Posrespuesta")) & "</b><br />"
				respEncontrada=true
				Rs.Close
				exit for
			end if
			Rs.close
		Next
		if not respEncontrada then
			response.Write("No se contestó") & "</b><br />"
		end if
		interruptor = 0
		%><br /><%
	end if


	 if i=4 or i=6 or i=9 or i=11 or i=12 or i=14 or i=15 or i=20 or i=21 or i=22 then
		DBresp.open "Select A.Idpregunta, C.Pregunta From (Respuestas A left join Posrespuesta B on (A.Idpregunta = B.Idpregunta)) left join Preguntas C on (A.Idpregunta = C.Idpregunta) Where A.Idpregunta = "& i &" and C.Idpregunta = "& i &"  Group By A.Idpregunta, C.Pregunta", Con
		Do While not DBresp.eof'Inicia el ciclo de respuestas
			x = DBresp("Pregunta") 
			x = replace(x,"___","")
			response.write "<b>Reactivo " & DBresp("Idpregunta") & ": " & x &  "</b><br />" 
			'response.write DBresp("Pregunta") &  "<br />" 
			DBresp.movenext
			%></b><%
		loop	
		DBresp.Close
		
		for j=1 to 5
			Rs.open "Select A.respuesta From (Respuestas A left join Regcontestada B on (A.Idcont = B.Idcont)) Where B.carrera ='"& idinst &"' and A.Idpregunta = "& i, Con
			if Not Rs.EOF Then
				response.Write(Rs("respuesta")) & "</b><br />"
				interruptor = 0
				Rs.movenext
				Rs.Close
				exit for
				else if Rs.EOF and interruptor = 0 Then
					response.Write("No se contestó") & "</b><br />"
					interruptor = 1
				end if
			end if
			Rs.close						
		Next
		interruptor = 0
		%><br /><%
	 end if
Next

		for i=23 to 27
			%><b><%
			DBresp.open "Select A.Idpregunta, C.Pregunta From (Respuestas A left join Posrespuesta B on (A.Idpregunta = B.Idpregunta)) left join Preguntas C on (A.Idpregunta = C.Idpregunta) Where A.Idpregunta = "& i &" and C.Idpregunta = "& i &"  Group By A.Idpregunta, C.Pregunta", Con 
			Do While not DBresp.eof'Inicia el ciclo de respuestas
				response.write "Reactivo " & DBresp("Idpregunta") & ": "' & DBresp("Pregunta") &  "<br />" 
				DBresp.movenext
				%></b><%
			loop	
			DBresp.Close
			
			for j=1 to 1
				DBresp.open "Select C.Posrespuesta, C.Punpreg, A.respuesta From (Respuestas A left join Regcontestada B on (A.Idcont = B.Idcont)) LEFT JOIN Posrespuesta C on (A.Idpregunta = C.Idpregunta) Where B.carrera ='"& idinst &"' and C.Punpreg = '"& j &"' and A.Idpregunta = "& i, Con
				r = 0
				Do While not DBresp.eof'Inicia el ciclo de respuestas
'					response.Write DBresp("respuesta") %><br /><%
'					DBresp.movenext
					j=j+1
						if (j=2) then
							if ( DBresp("respuesta") = "Escriba aquí") Then
								response.Write("No se contestó")
							else
								response.Write DBresp("respuesta")
							end if
							
						end if
					DBresp.movenext
				loop	
				DBresp.Close
			Next
			
			for j=1 to 6
				DBresp.open "Select A.respuesta, B.Posrespuesta From ((Respuestas A left join Posrespuesta B on (A.Idpregunta = B.Idpregunta)) left join Preguntas C on (A.Idpregunta = C.Idpregunta)) left join Regcontestada D on (A.Idcont = D.Idcont) Where A.respuesta = '"& j &"' and  A.Idpregunta = "& i &" and B.Punpreg = '"& j &"'  and C.Idpregunta = "& i &" and D.Carrera = '"& idinst &"' Group By  A.respuesta, B.Posrespuesta", Con  'Where A.Idpregunta = 4 and B.Punpreg = 3 and C.Idpregunta = 4
				Do While not DBresp.eof'Inicia el ciclo de respuestas
					response.Write "Nivel: "&DBresp("Posrespuesta")
					DBresp.movenext
					%><br /><%
				loop
				DBresp.Close
			Next
			%><br /><%
			
		Next
%><br /><%
y era todo, sólo ORDENAR todo, comenzando con mis ídeas....

De nuevo agradezco tu ayuda y por aquí andaré consultando nuevamente algunos temas...

Saludos.

PD: el código anterior será corregido para evitar tener líneas de más, una vez que haya tiempo jejejejeje