how to create register windows form Asp.net Using C#
in this tutorial we will learn how to create register windows form Asp.net Using C# with help of Visual Studio in so guyies let's get's started to crerate windows form in C#.
how to create register windows form Asp.net Using C#
Basically we will perform to insert values like to register using asp.net using C# and SQL Server.

First Step: Create Design in Windows Form
First of all you need to design Regiser Form for User Name and Password and Button For Regiser to insert data click button.
Second Step: Create Table in Sql Server Database
In this step you need to create a database first and after that Create Table which Query given Following
CREATE TABLE tbluser
(
Id int identity (1,1) not null,
user_name nvarchar(200) null,
password_ nvarchar(100)null
PRIMARY KEY
(
Id ASC
)
)
GO
Third Step: Create NameSpace in C#
using System.Data;
using System.Data.SqlClient;
Fourth Step : Create Connection Visual Studio C#
In this step we will Create Connection using SqlConnection Class of SqlClient if you want to know how to connect SQL Database in C# Windows
SqlConnection con =new SqlConnection("Data Source=WINCTRL-NAA1ARS\\SQLEXPRESS;Initial Catalog=dbdemo;Integrated Security=True");
con.Open();
Fifth Step: Write Sql Query
string query="insert into tbluser (user_name,pass) values ('"+txtusername.Text+"','"+txtpassword.Text+"')";
Sixth : Step : Use SqlCommand Class of SqlClient
SqlCommand cmd= new SqlCommand(query,con);
Seventh Step : Use ExecuteNonQuery to insert Values
cmd.ExecuteNonQuery().ToString();
Final Step : Close Connection
con.Close();
Final Code: Register Page In Asp.net C#
private void btnreg_Click(object sender, EventArgs e)
{
SqlConnection con =new SqlConnection("Data Source=WINCTRL-NAA1ARS\\SQLEXPRESS;Initial Catalog=dbdemo;Integrated Security=True");
con.Open();
string query="insert into tbluser (user_name,pass) values ('"+txtusername.Text+"','"+txtpassword.Text+"')";
SqlCommand cmd= new SqlCommand(query,con);
cmd.ExecuteNonQuery().ToString();
lblmessage.Text="Successfully added";
con.Close();
}