Ver Mensaje Individual
  #1 (permalink)  
Antiguo 08/09/2003, 16:14
Avatar de saymon
saymon
 
Fecha de Ingreso: septiembre-2003
Ubicación: Panama
Mensajes: 318
Antigüedad: 20 años, 9 meses
Puntos: 0
Insertar dinamicamente datos recojidos de CheckBOX

hola a todos !

Les agradecería mucho si me pueden ayudar en esto:

Yo tengo 2 archivos (variable.asp y recibir.asp). En el primero envio unos datos (nvariable) a el segundo archivo que los recoje e inserta, pero solamente me esta funcionando si selecciono un solo registro de los checkbox del primer archivo(variable.asp), me parece que es porque si selecciono dos o mas lo envia concatenado y me manda un error asi en el explorer:

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access Driver] Number of query values and destination fields are not the same.
/tesisanibal/Recibir.asp, line 15

POST Data:
variable=3&variable=4

Es algo parecido a lo que URJOSE explicaba aqui:
http://www.forosdelweb.com/showthre...?threadid=89704

Le envio el código:

Variable.asp

<html>
<head>
<title>Prueba hotmail</title>
</head>

<body>

<Form method=post action= Recibir.asp>

<table>
<tr>
<td>ID_pedido</td>
<td>Usuario</td>
</tr>
<%
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("\tesisanibal\db\calidad.mdb"))

SSQL="Select nvariable, descripcionvariable from variables where narea = '" & session("Rarea") & "'"
Set RS= Conn.Execute(SSQL)

Do while not RS.eof
%>
<tr>
<td>
<input type="checkbox" name="variable" value="<%=RS("nvariable")%>">
</td>
<td>
<%=RS("descripcionvariable")%>
</td>
</tr>
<%
RS.MoveNExt
LOOP
%>
</table>

<input type=submit>
</Form>
</body>
</html>


Recibir.asp

<html>


<body>


Les agradesco su ayuda y saludos a todos.

Anibal D.

<%
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("\tesisanibal\db\calidad.mdb"))



SSQL="insert into matrix (NVARIABLE) values (" & request.Form("variable") & ")"
Set RS= Conn.Execute(SSQL)
%>


</body>
</html>