Firoz Khan
Firoz Khan

Reputation: 666

Full Email Address is not Showing in @Email Column

I have a page for registration where i am saving details of users.

Page is working fine data is shaving but 'full email address' is not showing in table of '@email' column.

Example: if i am saving '[email protected]' it is showing only 'cozm02011' in table.

enter image description here

code behind

 protected void ceratenewuser_Click(object sender, EventArgs e)
    {

        String ConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
        SqlConnection con = new SqlConnection(ConnString);

        SqlCommand cmd = new SqlCommand();
        cmd.CommandType = CommandType.StoredProcedure;
        cmd.CommandText = "User_pro";

        cmd.Parameters.AddWithValue("@UserName", TextBox1.Text.Trim());
        cmd.Parameters.AddWithValue("@Password", TextBox2.Text.Trim());
        cmd.Parameters.AddWithValue("@Email", TextBox3.Text.Trim());

        cmd.Parameters.AddWithValue("@LastSeen", DateTime.Now);

        cmd.Parameters.AddWithValue("@CreatedDate", DateTime.Now);


        cmd.Connection = con;
        try
        {
            con.Open();
            cmd.ExecuteNonQuery();


            Label2.Text = "User Created successfully";

            TextBox1.Text = ""; TextBox2.Text = ""; TextBox3.Text = ""; TextBox4 .Text = "";
        }
        catch (Exception ex)
        {
            throw ex;
        }
        finally
        {
            con.Close();
            con.Dispose();
        }


        this.GridView1.DataBind();


    }

store procedure

ALTER PROCEDURE dbo.User_pro
@UserName varchar(20),
@Password varchar(20),
@Email varchar(50),
@LastSeen datetime,
@CreatedDate datetime

AS      

INSERT INTO User_tbl (UserName, Password, Email, LastSeen, CreatedDate)
VALUES (@UserName, @Password, @Email, @LastSeen, @CreatedDate)
RETURN

Upvotes: 0

Views: 88

Answers (2)

user3021830
user3021830

Reputation: 2924

You are binding the "Confirm password" field to the E-mail column

cmd.Parameters.AddWithValue("@Email", TextBox3.Text.Trim());

TextBox3 is used for "Confirm password" field.

Upvotes: 3

itzmebibin
itzmebibin

Reputation: 9439

Try this,

cmd.Parameters.AddWithValue("@Email", TextBox4.Text.Trim());

Upvotes: 2

Related Questions