You must Sign In to post a response.
  • Category: ASP.NET

    Registration Form Not working

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    namespace BEL
    {
    public class BELRegister
    {

    public string Name { get; set; }
    public string UserName { get; set; }
    public string Password { get; set; }
    public string Email { get; set; }
    public string Phone { get; set; }

    }
    }

    DalRegister.cs
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Data;
    using BEL;
    using System.Data.SqlClient;
    using System.Configuration;

    namespace DAL
    {

    public class DALRegister
    {

    SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["Dbconnection"].ToString());
    public int UserDetails(BELRegister br)
    {
    try
    {
    SqlCommand cmd = new SqlCommand("prcregisteration", con);
    cmd.CommandType = CommandType.StoredProcedure;
    cmd.Parameters.AddWithValue("@name", br.Name);
    cmd.Parameters.AddWithValue("@username", br.UserName);
    cmd.Parameters.AddWithValue("@password", br.Password);
    cmd.Parameters.AddWithValue("@email", br.Email);
    cmd.Parameters.AddWithValue("@phone", br.Phone);
    con.Open();
    int result = cmd.ExecuteNonQuery();
    cmd.Dispose();
    return result;
    }
    catch
    {
    throw;
    }
    }
    }

    }
    BALRegister.CS

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using BEL;
    using DAL;


    namespace BAL
    {
    public class BALRegister
    {
    DALRegister dr = new DALRegister();
    public int SaveUserRegistrationBAL(BELRegister br)
    {
    try
    {

    return dr.UserDetails(br);
    }
    catch (Exception ex)
    {
    ex.GetType();
    }
    return 0;
    }

    }
    }


    Registration.aspx.cs

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using BAL;
    using BEL;


    namespace OnlineExaminationPortal
    {
    public partial class Registration : System.Web.UI.Page
    {
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void Button1_Click(object sender, EventArgs e)
    {
    BELRegister objbr = new BELRegister();
    BALRegister objbl = new BALRegister();
    objbr.Name = TextBox2.Text;
    objbr.UserName = TextBox3.Text;
    objbr.Password = TextBox4.Text;
    objbr.Email = TextBox5.Text;
    objbr.Phone = TextBox6.Text;
    int value=objbl.SaveUserRegistrationBAL(objbr);
    Clear();
    if (value == 1)
    {
    Label1.Text = "Registered Successfully";
    }
    else
    {
    Label1.Text = "User Name Not Available.Try With Different User Name";
    }
    }



    public void Clear()
    {
    TextBox2.Text = "";
    TextBox3.Text = "";
    TextBox4.Text = "";
    TextBox5.Text = "";
    TextBox6.Text = "";
    }
    }
    }



    Please find the error and also let me know , how to move to login page after registration?

    <connectionStrings>
    <add name="Dbconnection"
    connectionString="Server=USER-PC\SHUKLAJI; Database=OnlineExamination; Integrated Security=True"
    providerName="System.Data.SqlClient" />
  • #768939
    Hai Aparna,
    I looked the code you have written and can't say about the issue and also it's difficult to run your code in any other machine because it need the database setup and all.
    So first try to debug and check at which line and what kind of error it is displaying. Then we can provide you the probable solution to fix the issue.
    Hope it will be helpful to you.

    Regards,
    Pawan Awasthi(DNS MVM)
    +91 8123489140 (whatsApp), +60 14365 1476(Malaysia)
    pawansoftit@gmail.com

  • #768944
    Hi,

    Have you got any error? If yes, please post the error details and make sure you have to debug the code and see where it gives problem before asking in forum.

    Please elaborate the issue clearly so that we can help you better.

    --------------------------------------------------------------------------------
    Give respect to your work, Instead of trying to impress your boss.

    N@veen
    Blog : http://naveens-dotnet.blogspot.in/

  • #768951
    Hi,

    As our members mentioned. It is very tough to predict the issue in the 100lines of code.
    There are many reasons we can able to find in the code,
    # You are taking the textbox1.text values in DB you might mention password should be 8 character. But you are taking values without trimming so it might take more than 8 characters and because of that issue might be there.
    # We are not sure about the SQL connection you have specified because of the connection issue might be there.

    So unless or until you provide us error screenshot or details about the error you got its tough.

    Thanks,
    Mani


Sign In to post your comments