Foros del Web » Programando para Internet » ASP Clásico »

Tengo Un Problema Al Introducir Datos Recogidos De Un Formulario A Una Base De Datos

Estas en el tema de Tengo Un Problema Al Introducir Datos Recogidos De Un Formulario A Una Base De Datos en el foro de ASP Clásico en Foros del Web. HOLA!!!!!!! TENGO UN PROBLEMA Y CREO QUE DEBE SER UNA COSITA NADA MAS. EL PROBLEMA ES EL SIGUIENTE: YO ESTOY TRATANDO DE METER EN LA ...
  #1 (permalink)  
Antiguo 15/02/2005, 09:12
Avatar de emilio21  
Fecha de Ingreso: enero-2005
Ubicación: Venezuela
Mensajes: 320
Antigüedad: 19 años, 5 meses
Puntos: 1
Exclamación Tengo Un Problema Al Introducir Datos Recogidos De Un Formulario A Una Base De Datos

HOLA!!!!!!!

TENGO UN PROBLEMA Y CREO QUE DEBE SER UNA COSITA NADA MAS.

EL PROBLEMA ES EL SIGUIENTE:
YO ESTOY TRATANDO DE METER EN LA BASE DE DATOS DATOS DE LOS USUARIOS RECOGIDOS DE UN FORMULARIO, PERO LA PAGINA QUE ME PROCESA LOS DATOS TIENE EN LA PARTE DE ABAJO UN REDIRECT, ENTONCES MIENTRAS ESTA PAGINA ME PROCESA LOS DATOS PARA INTRODUCIRLOS EN LA BASE EL ME FUNCIONA Y ME REDIRECCIONA LA PAGINA NORMALMENTE COMO SI HUBIESE REDOGIDO E INTRODUCIDO LAS DATOS A LA BASE. AL MOMENTO DE LOGUEAR AL USUARIO NO RECONOCE AL NOMBRE DE USUARIO NI A LA CONTRASEÑA, CLARO LA BASE ESTA VACIA.

EL CODIGO DE LA PAGINA QUE PROCESA LOS DATOS ES EL SIGUIENTE:

<html>
<head>
<title>Registro de usuario</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>
<body bgcolor="#FFFFFF" text="#000000" link="#FFFFFF" vlink="#33FF00" alink="#00CC33">
<%
Dim oConn
Set oConn = Server.CreateObject("ADODB.Connection")
' Configura aquí tu db
oConn.Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("db_1.mdb"))
strSQL = "select nombre from usuarios where nombre = '"& Request.Form("nombre") &"'"
Set objRS = oConn.Execute(strSQL)
if (objRS.Eof) then
strSQL = "insert into usuarios (nombre, clave, name, apellido, pais, estado, ciudad, telefono, email, cookie) values ('"& Request.Form("nombre") & "', '"& Request.Form("clave") & "', '"& Request.Form("name") & "', '"& Request.Form("apellido") & "', '"& Request.Form("pais") & "', '"& Request.Form("estado") & "', '"& Request.Form("ciudad") & "', '"& Request.Form("telefono") & "', '"& Request.Form("email") & "', 'no conectado')"

Response.Redirect("login.asp")
else
Response.Write("Ya Existe un Usuario con ese Nombre, Cambie su <a href=form.asp>Nombre de Usuario</a>")
end if
oConn.Close
%>
</body>
</html>

BUENO ESPERO QUE ME ATUDEN Y ME RESPONDAN PRONTO.... GRACIAS!!!!!!!!!!!!!!11
  #2 (permalink)  
Antiguo 15/02/2005, 09:44
Avatar de AlZuwaga
Colaborador
 
Fecha de Ingreso: febrero-2001
Ubicación: 34.517 S, 58.500 O
Mensajes: 14.550
Antigüedad: 23 años, 3 meses
Puntos: 535
Es que nunca estás ejecutando la sentencia para insertar el registro. Inmediátamente antes de la línea del redirect (Response.Redirect("login.asp")) colocá lo siguiente:

oConn.Execute(strSQL)
__________________
...___...
  #3 (permalink)  
Antiguo 15/02/2005, 09:55
Avatar de ludovico2000  
Fecha de Ingreso: noviembre-2003
Ubicación: Bizkaia
Mensajes: 1.315
Antigüedad: 20 años, 7 meses
Puntos: 2
¿No sería conveniente cambiar el nombre del segundo strSQL por otra cosa "insertardatos", p.ej.?
  #4 (permalink)  
Antiguo 15/02/2005, 11:08
Avatar de emilio21  
Fecha de Ingreso: enero-2005
Ubicación: Venezuela
Mensajes: 320
Antigüedad: 19 años, 5 meses
Puntos: 1
lo solucione cambiandolo por lo siguiente:

Set objinsert = oConn.Execute(strSQL2)
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 00:30.