Ver Mensaje Individual
  #1 (permalink)  
Antiguo 08/09/2010, 12:05
chispe
 
Fecha de Ingreso: agosto-2010
Mensajes: 31
Antigüedad: 13 años, 8 meses
Puntos: 0
Ayuda con variable y mysql

Tengo la siguiente duda tengo el siguiente codigo que muestra toda la informacion de unas maquinas que estan disponibles. Cuando se selecciona los checkbox este guarda los valores en una variable y despues los muestra.

La pregunta es ¿ Como puedo realizar una consulta para traer la informacion de las maquinas desde la base de datos con los datos que se guardan en la variable?

Código asp:
Ver original
  1. <%@LANGUAGE="VBSCRIPT"%>
  2. <!--#include virtual="/Connections/Conecciones.asp" -->
  3. <%
  4. Dim Maquinas
  5. Dim Maquinas_cmd
  6. Dim Maquinas_numRows
  7.  
  8. Set Maquinas_cmd = Server.CreateObject ("ADODB.Command")
  9. Maquinas_cmd.ActiveConnection = MM_Conecciones_STRING
  10. Maquinas_cmd.CommandText = "SELECT * FROM maquinas"
  11. Maquinas_cmd.Prepared = true
  12.  
  13. Set Maquinas = Maquinas_cmd.Execute
  14. Maquinas_numRows = 0
  15. %>
  16. <%
  17. Dim Repeat1__numRows
  18. Dim Repeat1__index
  19. Repeat1__numRows = -1
  20. Repeat1__index = 0
  21. Maquinas_numRows = Maquinas_numRows + Repeat1__numRows
  22. %>
  23. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  24. <html xmlns="http://www.w3.org/1999/xhtml">
  25. <head>
  26. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  27. <title>Ingreso Maquinas al Ssitema</title>
  28. </head>
  29. <body>
  30. <table width="200" border="0" align="center" class="readMore">
  31.   <tr class="HeaderCentro">
  32.     <td><!--#include file="header.asp" --></td>
  33.   </tr>
  34. </table>
  35. <tr></td>
  36. </tr>
  37. <table width="585" border="0" align="center" class="rightTxt1">
  38. <tr bgcolor="#FFFFFF">
  39.   <td width="579" height="235" class="readMore"><form id="form1" name="form1" method="post" action="carro_vendedores.asp">
  40.     <table width="427" border="0">
  41.       <tr>
  42.         <td width="47">ID</td>
  43.         <td width="72">Serie</td>
  44.         <td width="74">Tipo Maquina</td>
  45.         <td width="36">&nbsp;</td>
  46.         <td width="37">&nbsp;</td>
  47.       </tr>
  48.       <%
  49. While ((Repeat1__numRows <> 0) AND (NOT Maquinas.EOF))
  50. %>
  51.   <tr>
  52.     <td><input name="maquina" type="checkbox" id="maquina" value="<%=(Maquinas.Fields.Item("serie_maquina").Value)%>">
  53.       <label for="maquina"></label></td>
  54.     <td><%=(Maquinas.Fields.Item("serie_maquina").Value)%></td>
  55.     <td><%=(Maquinas.Fields.Item("tipo_maquina").Value)%></td>
  56.     <td>&nbsp;</td>
  57.     <td>&nbsp;</td>
  58.   </tr>
  59.   <%
  60.   Repeat1__index=Repeat1__index+1
  61.   Repeat1__numRows=Repeat1__numRows-1
  62.   Maquinas.MoveNext()
  63. Wend
  64. %>
  65.  
  66.  
  67.     </table>
  68.     <p>&nbsp;</p>
  69.     <p>&nbsp;</p>
  70.     <p>
  71.       <input type="submit" name="enviar" id="enviar" value="Seleccionar Maquinas" />
  72.   </p>
  73. </form>
  74.     <table width="545" border="0" align="center">
  75.       <tr class="Centrar">
  76.         <td width="114">Serie Maquina</td>
  77.         <td width="75">Condicion Maquina</td>
  78.         <td width="204">Tipo Maquina</td>
  79.         <td width="103">Tipo Botellon</td>
  80.         <td width="27">&nbsp;</td>
  81.       </tr>
  82.       <tr>
  83.         <td><%
  84.      Dim mode,mode_a,i
  85.      mode=Request("maquina")
  86.       mode_a=split(mode,",")
  87.       For Each item In mode_a
  88.     Response.Write(item & "<br />")
  89. Next
  90.  
  91.  %></td>
  92.         <td>&nbsp;</td>
  93.         <td>&nbsp;</td>
  94.         <td>&nbsp;</td>
  95.         <td>&nbsp;</td>
  96.         </tr>
  97.     </table>
  98.     <p>&nbsp;</p>
  99.     <p>&nbsp;</p></td>
  100. </tr>
  101. </table>
  102. <p class="Centrar">
  103.  
  104. </p>
  105. </body>
  106. </html>
  107. <%
  108. Maquinas.Close()
  109. Set Maquinas = Nothing
  110. %>

Gracias