Ver Mensaje Individual
  #1 (permalink)  
Antiguo 26/11/2013, 23:46
poeta3d
 
Fecha de Ingreso: diciembre-2010
Mensajes: 162
Antigüedad: 13 años, 4 meses
Puntos: 1
Pregunta login y registro de usuario

hola, amigos quiesiera saber si me podrian guiar con mi codigo no se que falla, aqui va el codigo:

Código HTML:
Boolean aceptado = false;
    protected void Btn_ingresar_Click(object sender, EventArgs e)
    {
        string cadena="Data Source=MUNDO\\SQLEXPRESS;Initial Catalog=registro_default;Integrated Security=True";
        SqlConnection con = new SqlConnection(cadena); 
        

        SqlCommand com=new SqlCommand("select * form tabla_registro where usuario='"+Text_usuarioingreso.Text+"',and contraseña'"+Text_contraseñaingreso.Text+"'",con);
        con.Open();

        SqlDataReader leerdb = com.ExecuteReader();

        if (leerdb.Read() == true)
        {
            aceptado = true;
        }
        else
        {
            aceptado = false;
        }
        if (aceptado == true)
        {
            Response.Redirect("formulario.aspx");
        }
        else
        {
            Response.Redirect("default.aspx");
        }
        con.Close();
        

        int respuesta;
        respuesta=Convert.ToInt32(com.ExecuteScalar());

        if(respuesta==1)
        {
            Response.Redirect("formulario.aspx");
        }

   
   
    }
    protected void Button_registro_Click(object sender, EventArgs e)
    {
        string cadena = "Data Source=MUNDO\\SQLEXPRESS;Initial Catalog=registro_default;Integrated Security=True";
        SqlConnection con = new SqlConnection(cadena);
        con.Open();

        SqlCommand com = new SqlCommand("insert * into tabla_registro values('"+Text_nombre.Text+"'.'"+Text_apellido.Text+"','"+Text_usuario.Text+"','"+Text_contraseña.Text+"','"+DropDown_edad.Text+"','"+Text_correo.Text+"')", con);
        com.ExecuteNonQuery();
        
        if (com.ExecuteNonQuery() > 0)
        {
            
            Label1.Text = "Registro existoso";
        }
        else
        {
            Label1.Text = "Registro fallo";
        }
mi problema es que aparentemente mi codigo no funciona, me faltara algo mas?