Monday, 14 May 2012

0 user registration form in asp.net

Step 1:- Open a new website project

Design your page just like fig.1.0

Fig.1.0
 Step 2:- Open the CS file and copy pest the below code




public partial class register : System.Web.UI.Page
{

    SqlConnection con = new SqlConnection("Data Source=Server name;Initial Catalog=Database name;Integrated Security=True");

    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void button1_Click(object sender, EventArgs e)
    {
        SqlCommand myCmdd = new SqlCommand("INSERT INTO tablename (Name,Email_Id,Password,Re_password) VALUES  ('" + txtname.Text + "','"+txtuserid.Text + "','" + txtpwd.Text + "','" + txtrepwd.Text + "')", con);


        mycmdd.Connection.Open();

        mycmdd.ExecuteNonQuery();
        con.Close();
        txtrepwd.Text = "";
        txtname.Text = "";
        txtpwd.Text = "";
        txtuserid.Text = "";
        Label1.Text = "Registration Successful ";
    }
    protected void btnclear_Click(object sender, EventArgs e)
    {
        txtrepwd.Text = "";
        txtname.Text = "";
        txtpwd.Text = "";
        txtuserid.Text = "";
    }
}

0 comments:

Post a Comment

 

Coding Authority Copyright © 2011 - |- Template created by O Pregador - |- Powered by Blogger Templates