Click here to Skip to main content
15,896,512 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
1. Creat a Registration SQl table

entities are username, password,E-mail,company,country

2. Creat a LOgin SQL table


Entities are User name, password
HTML
When we register in register page how to creat the "user name, password" added to the login table without adding to registration table



Send to me plez

[edit]Email removed - OriginalGriff[/edit]
Posted
Updated 15-May-12 23:05pm
v3
Comments
sharmroystan 16-May-12 5:03am    
did i want to give relationships
OriginalGriff 16-May-12 5:05am    
Never post your email address in any forum, unless you really like spam! If anyone replies to you, you will receive an email to let you know
Prasad_Kulkarni 16-May-12 5:05am    
..and question is??
please elaborate your question with some code snippet.
sunandandutt 16-May-12 5:10am    
please elaborate question.

1 solution

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.

C#
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);

        // Create a dataset object
        DataSet ds = new DataSet("UserInformationSet");
        adapter.Fill(ds, "UserInformation");

        // Create a data table object and add a new row
        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);
       
        // Update data adapter
        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;
        
    }
    }
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900