← Foro de ASP

Problema con un query

Hilo en el foro de ASP · 30 de Julio del 2003 · 0 respuestas
Ibest30 de Julio del 2003
Pregunta
Muy buenas amigos.
Desde aquí os pido ayuda para solucionar el siguiente problema con el que llevo unos cuantos días buenos y no doy con la solución. A ver si podeis ayudarme.

Tipo de error:
ADODB.Recordset (0x800A0BB9)
Argumentos incorrectos, fuera del intervalo permitido o en conflicto con otros.

Aquí os mando el código por si os sirve para verlo mejor:

<html>

<head>
</head>

<body bgcolor="#FFFF99">

<form action="formulario.asp" method="get" onsubmit="return FrontPage_Form1_Validator(this)" name="FrontPage_Form1">
<h1>Formulario de Registro</h1>
<table border="0" width="100%" height="1369">
<tr>
<td width="100%" colspan="3" height="21">* Campos a rellenar
obligatoriamente.</td>
</tr>
<tr>
<td width="100%" colspan="3" height="59">** La contraseña ha de contener un
mínimo de cinco caracteres y un máximo de diez. Pueden utilizarse solo
letras o números, combinaciones de ambas, y/o espacios en blanco.
<p> </td>
</tr>
<tr>
<td width="35%" height="54">*Nombre</td>
<td width="65%" colspan="2" height="54"><!--webbot bot="Validation"
S-Data-Type="String" B-Allow-Letters="TRUE" B-Allow-WhiteSpace="TRUE"
B-Value-Required="TRUE" I-Minimum-Length="3" I-Maximum-Length="50" --><input type="text" name="nombre" size="32" maxlength="50"></td>
</tr>
<tr>
<td width="35%" height="53">*Apellidos</td>
<td width="65%" colspan="2" height="53"><!--webbot bot="Validation"
S-Data-Type="String" B-Allow-Letters="TRUE" B-Allow-WhiteSpace="TRUE"
B-Value-Required="TRUE" I-Minimum-Length="3" I-Maximum-Length="50" --><input type="text" name="apellidos" size="32" maxlength="50"></td>
</tr>
<tr>
<td width="35%" height="55">*Domicilio</td>
<td width="65%" colspan="2" height="55"><!--webbot bot="Validation"
S-Data-Type="String" B-Allow-Letters="TRUE" B-Allow-Digits="TRUE"
B-Allow-WhiteSpace="TRUE" B-Value-Required="TRUE" I-Minimum-Length="5"
I-Maximum-Length="50" --><input type="text" name="domicilio" size="32" maxlength="50"></td>
</tr>
<tr>
<td width="35%" height="54">*Provincia </td>
<td width="65%" colspan="2" height="54"><!--webbot bot="Validation"
S-Data-Type="String" B-Allow-Letters="TRUE" B-Allow-WhiteSpace="TRUE"
B-Value-Required="TRUE" I-Minimum-Length="5" I-Maximum-Length="50" --><input type="text" name="provincia" size="32" maxlength="50"></td>
</tr>
<tr>
<td width="35%" height="54">*Código Postal</td>
<td width="65%" colspan="2" height="54"><!--webbot bot="Validation"
S-Data-Type="Number" S-Number-Separators="x," B-Value-Required="TRUE"
I-Minimum-Length="5" I-Maximum-Length="5" --><input type="text" name="codigo_postal" size="32" maxlength="5"></td>
</tr>
<tr>
<td width="35%" height="55">*Telf.. de Contacto:</td>
<td width="33%" height="55"><!--webbot bot="Validation" S-Data-Type="Number"
S-Number-Separators="x," B-Value-Required="TRUE" I-Minimum-Length="9"
I-Maximum-Length="9" --><input type="text" name="tlfdecontacto" size="32" maxlength="9"></td>
<td width="32%" height="55">Ejemplo: 928352434</td>
</tr>
<tr>
<td width="35%" height="53">*E-mail</td>
<td width="65%" colspan="2" height="53"><!--webbot bot="Validation"
S-Data-Type="String" B-Allow-Letters="TRUE" B-Allow-Digits="TRUE"
B-Allow-WhiteSpace="TRUE" B-Value-Required="TRUE" I-Minimum-Length="3"
I-Maximum-Length="50" --><input type="text" name="e_mail" size="32" maxlength="50"></td>
</tr>
<tr>
<td width="35%" height="53">*D.N.I.:</td>
<td width="33%" height="53"><!--webbot bot="Validation" S-Data-Type="String"
B-Allow-Letters="TRUE" B-Allow-Digits="TRUE" B-Value-Required="TRUE"
I-Minimum-Length="9" I-Maximum-Length="9" --><input type="text" name="dni" size="32" maxlength="9"></td>
<td width="32%" height="53">Ejemplo: 78487766J</td>
</tr>
<tr>
<td width="35%" height="54">**Contraseña:</td>
<td width="65%" colspan="2" height="54"><!--webbot bot="Validation"
S-Data-Type="String" B-Allow-Letters="TRUE" B-Allow-Digits="TRUE"
B-Allow-WhiteSpace="TRUE" B-Value-Required="TRUE" I-Minimum-Length="5"
I-Maximum-Length="10" --><input type="password" name="contrasena" size="32" maxlength="10"></td>
</tr>
<tr>
<td width="35%" height="50">**Confirmar Contraseña:</td>
<td width="65%" colspan="2" height="50"><!--webbot bot="Validation"
S-Data-Type="String" B-Allow-Letters="TRUE" B-Allow-Digits="TRUE"
B-Allow-WhiteSpace="TRUE" B-Value-Required="TRUE" I-Minimum-Length="5"
I-Maximum-Length="10" --><input type="password" name="confirma_contrasena" size="32" maxlength="10"></td>
</tr>
<tr>
<td width="100%" colspan="3" height="47">
<p align="left"></td>
</tr>
<tr>
<td width="100%" colspan="3" height="53"><b><i>La cumplimentación</i></b>
de los siguientes datos no es obligatorio para darse de alta como cliente
de mercaweb.</td>
</tr>
<tr>
<td width="100%" colspan="3" height="28">
<p align="center"><font size="5"><b>DATOS ESTADÍSTICOS</b></font></td>
</tr>
<tr>
<td width="100%" colspan="3" height="21"></td>
</tr>
<tr>
<td width="35%" height="50">Edad  </td>
<td width="65%" colspan="2" height="50"><select size="1" name="edad">
<option>18 - 25</option>
<option>26 - 30</option>
<option>31 - 35</option>
<option>36 - 40</option>
<option>41 - 45</option>
<option>46 - 50</option>
<option>51 - 55</option>
<option>56 - 60</option>
<option>61 - 65</option>
<option>66 - 70</option>
<option>71 - 75</option>
<option>76 - 80</option>
<option>81 - 85</option>
<option>86 - 90</option>
<option>91 - 95</option>
<option>96 - 100</option>
</select></td>
</tr>
<tr>
<td width="35%" height="51">Sexo</td>
<td width="65%" colspan="2" height="51"><input type="radio" value="V3" name="sexo" checked>Hombre   
<input type="radio" name="sexo" value="V4">Mujer</td>
</tr>
<tr>
<td width="35%" height="55">Profesión/Ocupación</td>
<td width="65%" colspan="2" height="55"><!--webbot bot="Validation"
S-Data-Type="String" B-Allow-Letters="TRUE" --><input type="text" name="trabajo" size="32"></td>
</tr>
<tr>
<td width="35%" height="50">Estado Civil</td>
<td width="65%" colspan="2" height="50"><select size="1" name="estado_civil">
<option>Casado</option>
<option>Soltero</option>
<option>Separado/Divorciado</option>
<option>Viudo</option>
</select></td>
</tr>
<tr>
<td width="35%" height="50">Familia Numerosa</td>
<td width="65%" colspan="2" height="50"><input type="radio" name="numerosa" value="L3" checked>Si          
<input type="radio" name="numerosa" value="L4">No</td>
</tr>
<tr>
<td width="35%" height="49">Número de hijos</td>
<td width="65%" colspan="2" height="49"><select size="1" name="hijos">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>+ de 5</option>
</select></td>
</tr>
<tr>
<td width="35%" height="46">Hobbies</td>
<td width="65%" colspan="2" height="46"></td>
</tr>
<tr>
<td width="34%" height="45"><input type="checkbox" name="C1" value="ON">Viajes</td>
<td width="33%" height="45"><input type="checkbox" name="C2" value="ON">Informática</td>
<td width="33%" height="45"><input type="checkbox" name="C3" value="ON">Negocios</td>
</tr>
<tr>
<td width="34%" height="46"><input type="checkbox" name="C4" value="ON">Playa</td>
<td width="33%" height="46"><input type="checkbox" name="C5" value="ON">Campo</td>
<td width="33%" height="46"><input type="checkbox" name="C6" value="ON">Cine</td>
</tr>
</table>
<p><input type="checkbox" name="C7" value="ON">Marque esta casilla de
verificación si desea recibir información sobre nuestras ofertas.
</p>
<p><br><br>
<a href="../../../../../../Inetpub/wwwroot/supermercado/Pedro_Secciones.htm">
<input type="submit" value="Dar de Alta" style="font-weight: bold; border: 1px outset #CCCCCC; background-color: #CCCCCC">
</a>
</p>
</form>

<%
\'código de inserta alumno de la fase 4

Set BD=Server.CreateObject("ADODB.Connection")
\'BD.ConnectionString = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ="& Server.Mappath("../data/bd1.1.mdb")
BD.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=C:\Inetpub\wwwroot\supermercado\data\supermercado.mdb;"


Set nueva_registrados=Server.CreateObject("ADODB.Recordset")

\'query="SELECT * FROM Usuarios WHERE Login=\'" & request.form("flogin") & "\'"

nueva_registrados.Open query,BD

if nueva_registrados.EOF then
\'Se puede insertar

\'Todo la linea siguiente se cierra entre comillas
\'Cada uno de los de Value se escriben: \'" & (..) & "\' separados por comas
\'query="INSERT INTO Nueva_Registrados(Nombre,Apellidos,Domicilio,Provincia,Código postal,TLF_decontacto,E_mail,DNI,Contraseña) VALUES(\'" & request.form("nombre") & "\',\'" & request.form("apellidos") & "\',\'" & request.form("domicilio") & "\',\'" & request.form("provincia") & "\',\'" & request.form("codigo_postal") & "\',\'" & request.form("tlfdecontacto") & "\',\'" & request.form("e_mail") & "\',\'" & request.form("dni") & "\',\'" & request.form("contrasena") & "\')"
\'Estos de aqu?encima son los campos de la BD
\'BD.Execute(query)

\'Ahora se rellenan los datos estadísticos
\'Falta poner el campo hobbies
\'query="INSERT INTO Datos_Estadísticos(Edad,Sexo,Profesión_Ocupación,Estado_Civil,Familia_numerosa,Numerodehijos) VALUES(\'" & request.form("edad") & "\',\'" & request.form("sexo") & "\',\'" & request.form("trabajo") & "\',\'" & request.form("estado_civil") & "\',\'" & request.form("numerosa") & "\',\'" & request.form("hijos") & "\')"
\'BD.Execute(query)

Response.Write ("<br> Enhorabuena " & Request.form("nombre"))
Response.Write (", ya estás registrado")

BD.Close
else
Response.Write ("Error! Ya existe el mismo login en la base de datos. Debe elegir otro login.")
end if

%>

<p> </p>

</body>
</html>


¿Buscas más hilos como este? Mira el foro de ASP o usa el buscador.