My Dear Friend Follow this EASY STEPS:
Start->Run->Open SqlServer Management Studio OR shortcut is Open Start menu type SQLWB
Right Click on Database->Select New Database->Give ur Database Name
Extract the Database which u have created->Go to tables->New Table
then Add the fields as
Please make sure to create only one TABLE with Name UserInformation.(In this it will cover Everything)
Id -Int...click Notnull and Give Primary Key...ok
UserName - nvarchar(50) click allow nulls
Password - nvarchar(50) click allow nulls
Email - nvarchar(50) click allow nulls
Company - nvarchar(50) click allow nulls
Country - nvarchar(50) click allow nulls
and save the table(Ctrl+S)..give name as UserInformation.
Open visual studio
Go to ur Design Page(Registration Page) Take 4 textboxes and a button
display username,PAssword,Email,company,Country in design page.
and finally set the ids of textboxes and give validations.
and this is code behind page....follow these for ur registration page.
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.Web.Configuration;
public partial class Registration : System.Web.UI.Page
{
private static readonly String _connString = String.Empty;
SqlConnection con = new SqlConnection(_connString);
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(_connString);
con.Open();
SqlDataAdapter adapter = new SqlDataAdapter("SELECT * FROM UserInformation", con);
SqlCommandBuilder builder = new SqlCommandBuilder(adapter);
DataSet ds = new DataSet("UserInformationSet");
adapter.Fill(ds, "UserInformation");
DataTable UserInformationTable = ds.Tables["UserInformation"];
DataRow row = UserInformationTable.NewRow();
row["UserName"] = TxtUserName.Text;
row["Password"] = TxtPassword.Text;
row["Email"] = TxtEmail.Text;
row["Company"] = TxtCompany.Text;
row["Country"] = TxtCountry.Text;
UserInformationTable.Rows.Add(row);
adapter.Update(ds, "UserInformation");
con.Close();
Label1.Text="Your Application has been Successfully Submitted";
TxtUserName.Text = String.Empty;
TxtPassword.Text = String.Empty;
TxtEmail.Text = String.Empty;
TxtCompany.Text = String.Empty;
TxtCountry.Text = String.Empty;
}
static RegistrationPage()
{
_connString = WebConfigurationManager.ConnectionStrings["DataBaseNameConnectionString"].ConnectionString;
}
}