zoukankan      html  css  js  c++  java
  • .NET注册页面代码

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Data.SqlClient;
    using System.Configuration;
    using System.Web.UI.WebControls;

    public partial class _Default : System.Web.UI.Page
    {
    protected void Page_Load(object sender, EventArgs e)
    {
    }
    protected void res_btn_Click(object sender, EventArgs e)
    {
    string Conn = "server=(local);database=YGC;UId=sa;password=sa";
    SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Conn"].ConnectionString); //创建连接查询
    conn.Open();
    string cmdtext = "insert into account (account,password) values ('" + TextBox1.Text + "','" + TextBox2.Text + "')";
    SqlCommand cmd = new SqlCommand(cmdtext, conn);
    cmd.ExecuteNonQuery();

    Response.Write("<script>alert('注册成功!');window.location.href ='login.aspx'</script>");

    conn.Close();
    }
    }

    前端代码:

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

    <!DOCTYPE html>

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
    </head>
    <body>
    <form id="form1" runat="server">
    <div>
    <asp:Label ID="Label1" runat="server" Text="用户名"></asp:Label>
    <asp:TextBox ID="TextBox1" runat="server" ></asp:TextBox>
    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="TextBox1" runat="server" ErrorMessage="用户名不能为空"></asp:RequiredFieldValidator>
    <br/>
    密 码
    <asp:TextBox ID="TextBox2" runat="server" ></asp:TextBox>
    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" ControlToValidate="TextBox2"

    runat="server" ErrorMessage="密码不能为空"></asp:RequiredFieldValidator>
    <br/>
    <asp:Button ID="res_btn" runat="server" BorderStyle="None" Height="37px"
    Text="注册" Width="115px" onclick="res_btn_Click" />
    </div>
    </form>
    </body>
    </html>

  • 相关阅读:
    Blank page instead of the SharePoint Central Administration site
    BizTalk 2010 BAM Configure
    Use ODBA with Visio 2007
    Handling SOAP Exceptions in BizTalk Orchestrations
    BizTalk与WebMethods之间的EDI交换
    Append messages in BizTalk
    FTP protocol commands
    Using Dynamic Maps in BizTalk(From CodeProject)
    Synchronous To Asynchronous Flows Without An Orchestration的简单实现
    WSE3 and "Action for ultimate recipient is required but not present in the message."
  • 原文地址:https://www.cnblogs.com/YangGC/p/5115384.html
Copyright © 2011-2022 走看看