Friday, 2 July 2021

How to Create/Build Registration From

7/02/2021 - By Pranav Singh 0


This article will show you how you can create registration form in c#.net with SQL database. So in this article I have used Ms SQL server database. In this I will save the user login detail into sql table by using c#.net

First we will create a windows application registration form.




Above form is a custom design registration from and you can check how to create a custom registration from in windows application.

On submit button add the below code.

private void btnSubmit_Click(object sender, EventArgs e)
        {
            string connection = @"Server=LAPTOP-EVJEKV38\SQLEXPRESS; Database=TestDB; Integrated Security=True";
            SqlConnection con = new SqlConnection(connection);
            try
            {
                string query = "Insert into UserLogin(Name,EmailId,LoginId,Password) Values('" + txtName.Text + "','" + txtEmailId.Text + "','" + txtLoginId.Text + "','" + txtpassword.Text + "')";
                SqlDataAdapter da = new SqlDataAdapter(query, con);
                con.Open();
                da.SelectCommand.ExecuteNonQuery();
                MessageBox.Show("Account created successfully..");
                ClearData();
            }
            catch
            {
                MessageBox.Show("Error occured...");
            }
            finally
            {
                con.Close();
            }
        }
        //Clear data after submit
        private void ClearData()
        {
            txtName.Text = "";
            txtEmailId.Text = "";
            txtLoginId.Text = "";
            txtpassword.Text = "";
            txtConPassword.Text = "";
        }

Here is above code I have saved the data into the database. After saving the record a message will show and later all the records have been cleared. Now let’s run the application and check the output. For this I have created a table named as UserLogin.

In above code u need to change the connection string as per your server database and change the query as per you need.

Now add the detail into form and click on submit.




Now check the data base for detail



DOWNLOAD




About the Author

We are the group of people who are expertise in different Microsoft technology like Asp.Net,MVC,C#.Net,VB.Net,Windows Application,WPF,jQuery,Javascript,HTML. This blog is designed to share the knowledge.

Get Updates

Subscribe to our e-mail newsletter to receive updates.

Share This Post

0 comments:

Please let me know your view

Free Ebooks


About Us

We are the group of people who are expertise in different Microsoft technology like Asp.Net,MVC,C#.Net,VB.Net,Windows Application,WPF,jQuery,Javascript,HTML. This blog is designed to share the knowledge.

Contact Us

For writing article in this website please send request by your

GMAIL ID: dotnetpools@gmail.com

Bugs and Suggestions

As we all know that this website is for sharing knowledge and providing proper solution. So while reading the article is you find any bug or if you have any suggestion please mail us at contact@aspdotnet-pools.com.

Partners


Global Classified : Connectseekers.com
© 2014 aspdotnet-pools.com Designed by Bloggertheme9.
back to top