asp.net“用户名,密码"添加 [英] asp.net "user name, password" added

查看:91
本文介绍了asp.net“用户名,密码"添加的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

1. 创建注册SQl表

实体是用户名,密码,电子邮件,公司,国家/地区

2. 创建一个LOgin SQL表


实体是用户名,密码

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

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




发送给我plez

[edit]电子邮件已删除-OriginalGriff [/edit]




Send to me plez

[edit]Email removed - OriginalGriff[/edit]

推荐答案

亲爱的朋友,请按照以下简单步骤操作:

单击开始"->运行"->打开SqlServer Management Studio"或快捷方式为打开",开始菜单类型为SQLWB

右键单击数据库"->选择新数据库"->提供您的数据库名称
提取您创建的数据库->转到表格->新建表格
然后将字段添加为

请确保仅创建一个名称为UserInformation的表.(其中将覆盖所有内容)

Id -Int ...单击不为空"并提供主键...确定
用户名-nvarchar(50)单击允许空值
密码-nvarchar(50)单击允许空值
电子邮件-nvarchar(50)单击允许空值
公司-nvarchar(50)单击允许空值
国家-nvarchar(50)单击允许空值

并将表(Ctrl + S)..将名称保存为UserInformation.


打开Visual Studio
转到ur设计页面(注册页面)带有4个文本框和一个按钮
在设计页面中显示用户名,密码,电子邮件,公司,国家/地区.
最后设置文本框的ID并进行验证.

这是页面后面的代码....在ur注册页面中遵循这些代码.

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

        // 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;
        
    }
    }


这篇关于asp.net“用户名,密码"添加的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆