本文介绍了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]

推荐答案

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“用户名,密码"添加的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 07:16