Ver Mensaje Individual
  #1 (permalink)  
Antiguo 21/11/2008, 10:39
3LmI
 
Fecha de Ingreso: septiembre-2008
Ubicación: Coatzacoalcos
Mensajes: 44
Antigüedad: 16 años, 7 meses
Puntos: 0
Pregunta Problemas con la consulta

Hola buenos dias, tengo un problema con una consulta.
Se supone que la consulta si se realiza pero si quiero que se muestren todos los registros, pero cuando quiero que me muestre los registros que estan dentro de un rango ya no lo hace no me muestra nada por favor alguien me puede ayudar...
Aqui les dejo el codigo de mi consulta, espero de verdad su ayuda... Gracias

Código asp:
Ver original
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  2. "http://www.w3.org/TR/html4/loose.dtd">
  3. <html>
  4. <head>
  5.  
  6. <title>REPORTE SALAS</title>
  7. </head>
  8.  
  9.  <!--#include Virtual ="Reservaciones\connsql.asp"-->
  10.  
  11. <body>
  12.  
  13. <% 
  14. Mes = Request.QueryString("Meses")
  15. Anio = Request.QueryString("Anio")
  16.  
  17. fechaini = "01/"& Mes &"/"& Anio
  18. fechafin = "31/"& Mes&"/"& Anio
  19.  
  20.             sql1 = "SELECT * FROM reservsala "
  21.             sql2 = "WHERE  fecha_inicio>= '"&fecini&"' and fecha_inicio<= '"&fecfin&"' "
  22.             sql3 = "ORDER by fecha_inicio;"
  23.             sqls = sql1 & sql2 & sql3
  24.      
  25. Response.Write "<table border='0' width='100%' cellspacing='0' cellpadding='0'>"
  26. Response.Write "<tr>"
  27. Response.Write "<td width='12%' align='center' font face='Cambria' align='center'><p><Strong>REPORTE GENERAL DE SALAS</Strong></p></td>"
  28. Response.Write "</tr>"
  29. Response.Write "</table>"
  30.    
  31. Response.Write "<div align='center'><center>"
  32. Response.Write "<table width='100%'  class='style1' style='border-color: #000000; border-style: solid' cellspacing='1' cellpadding='1'>"
  33. Response.Write "<tr>"
  34. Response.Write "<td width='6%' align='center' bgcolor='#000000'><small><font face='Arial' color='#FFFFFF'><strong> SALA </strong></font></small></td>"
  35. Response.Write "<td width='6%' align='center' bgcolor='#000000'><font face='Cambria' color='#FFFFFF'><small><strong> USUARIO </strong></small></font></td>"
  36. Response.Write "<td width='6%' align='center' bgcolor='#000000'><font face='Cambria' color='#FFFFFF'><small><strong> GERENCIA </strong></small></font></td>"
  37. Response.Write "<td width='6%' align='center' bgcolor='#000000'><font face='Cambria' color='#FFFFFF'><small><strong>DEPARTAMENTO</strong></small></font></td>"
  38. Response.Write "<td width='6%' align='center' bgcolor='#000000'><font face='Cambria' color='#FFFFFF'><small><strong>FECHA DE SOLICITUD</strong></small></font></td>"
  39. Response.Write "<td width='6%' align='center' bgcolor='#000000'><font face='Cambria' color='#FFFFFF'><small><strong>FECHA INICIO</strong></small></font></td>"
  40. Response.Write "<td width='6%' align='center' bgcolor='#000000'><font face='Cambria' color='#FFFFFF'><small><strong>FECHA TERMINO</strong></small></font></td>"
  41. Response.Write "<td width='6%' align='center' bgcolor='#000000'><font face='Cambria' color='#FFFFFF'><small><strong>HORA INICIO</strong></font></small></td>"
  42. Response.Write "<td width='6%' align='center' bgcolor='#000000'><font face='Cambria' color='#FFFFFF'><small><strong>HORA FINAL</strong></small></font></td>"
  43. Response.Write "<td width='6%' align='center' bgcolor='#000000'><font face='Cambria' color='#FFFFFF'><small><strong>CURSO</strong></small></font></td>"
  44. Response.Write "<td width='6%' align='center' bgcolor='#000000'><font face='Cambria' color='#FFFFFF'><small><strong>CANTIDAD DE PERSONAS</strong></small></font></td>"
  45. Response.Write "<td width='6%' align='center' bgcolor='#000000'><font face='Cambria' color='#FFFFFF'><small><strong>SERVICIO</strong></small></font></td>"
  46. Response.Write "<td width='6%' align='center' bgcolor='#000000'><font face='Cambria' color='#FFFFFF'><small><strong>PROPORCIONADO POR</strong></small></font></td>"
  47. Response.Write "<td width='6%' align='center' bgcolor='#000000'><font face='Cambria' color='#FFFFFF'><small><strong>OBSERVACIONES</strong></small></font></td>"
  48. Response.Write "<td width='6%' align='center' bgcolor='#000000'><font face='Cambria' color='#FFFFFF'><small><strong>TIPO DE SALA</strong></font></small></td>"
  49. Response.Write "</tr>"
  50.  
  51.             Set rs = Server.CreateObject("ADODB.Recordset")
  52.             rs.Open sqls, conn, 3, 3
  53.  
  54.             do while not rs.EOF
  55.             nom_sala = rs.fields("nom_sala")
  56.             nombre = rs.fields("nombre")
  57.             gerencia = rs.fields("gerencia")
  58.             depto = rs.fields("departamento")
  59.             fecha_soli = rs.fields("fecha_soli")
  60.             fecha_inicio = rs.fields("fecha_inicio")
  61.             fecha_termi = rs.fields("fecha_termi")
  62.             inicial_hrs = rs.fields("dur_inicial_hrs")
  63.             inicial_min = rs.fields("dur_inicial_min")
  64.             dur_inicial = inicial_hrs + ":" + inicial_min
  65.             final_hrs = rs.fields("dur_final_hrs")
  66.             final_min = rs.fields("dur_final_min")
  67.             dur_final = final_hrs + ":" + final_min
  68.             curso = rs.fields("curso")
  69.             cantidad_pers = rs.fields("cantidad")
  70.             servicio = rs.fields("serv_cafe")
  71.             proporcionado = rs.fields("proporcionado_por")
  72.             observaciones = rs.fields("observaciones")
  73.             tipo_sala = rs.fields("tipo_sala")
  74.            
  75.                   Response.Write "<tr>"
  76.                  Response.Write "<td width='6%' align='Left' style='border: 2px solid #000000' ><strong><font face='Arial'><small>" & nom_sala & "</small></font></strong></td>"
  77.                  Response.Write "<td width='6%' align='Left' style='border: 2px solid #000000'><strong><font face='Arial'><small>" & nombre & "</small></font></strong></td>"
  78.                  Response.Write "<td width='6%' align='Left' style='border: 2px solid #000000'><strong><font face='Arial'><small>" & gerencia & "</small></font></strong></td>"
  79.                  Response.Write "<td width='6%' align='Left' style='border: 2px solid #000000'><strong><font face='Arial'><small>" & depto & "</small></font></strong></td>"
  80.                  Response.Write "<td width='6%' align='Left' style='border: 2px solid #000000'><strong><font face='Arial'><small>" & fecha_soli & "</small></font></strong></td>"
  81.                  Response.Write "<td width='6%' align='Left' style='border: 2px solid #000000'><strong><font face='Arial'><small>" & fecha_inicio & "</small></font></strong></td>"
  82.                  Response.Write "<td width='6%' align='Left' style='border: 2px solid #000000'><strong><font face='Arial'><small>" & fecha_termi & "</small></font></strong></td>"
  83.                  Response.Write "<td width='6%' align='Left' style='border: 2px solid #000000'><strong><font face='Arial'><small>" & dur_inicial & "</small></font></strong></td>"
  84.                  Response.Write "<td width='6%' align='Left' style='border: 2px solid #000000'><strong><font face='Arial'><small>" & dur_final & "</small></font></strong></td>"
  85.                  Response.Write "<td width='6%' align='Left' style='border: 2px solid #000000'><strong><font face='Arial'><small>" & curso & "</small></font></strong></td>"
  86.                  Response.Write "<td width='6%' align='Left' style='border: 2px solid #000000'><strong><font face='Arial'><small>" & cantidad_pers & "</small></font></strong></td>"
  87.                  Response.Write "<td width='6%' align='Left' style='border: 2px solid #000000'><strong><font face='Arial'><small>" & servicio & "</small></font></strong></td>"
  88.                  Response.Write "<td width='6%' align='Left' style='border: 2px solid #000000'><strong><font face='Arial'><small>" & proporcionado & "</small></font></strong></td>"
  89.                  Response.Write "<td width='6%' align='Left' style='border: 2px solid #000000'><strong><font face='Arial'><small>" & observaciones & "</small></font></strong></td>"
  90.                  Response.Write "<td width='6%' align='Left' style='border: 2px solid #000000'><strong><font face='Arial'><small>" & tipo_sala & "</small></font></strong></td>"
  91.                  Response.Write "</tr>"
  92.                 rs.MoveNext  
  93.                 loop
  94.                 rs.Close  
  95. %>  
  96. </body>
  97. </html>


de antemano gracias