WEB开发网
开发学院WEB开发ASP.NET .aspx制作链接数据库并互相跳转的登录与注册 阅读

.aspx制作链接数据库并互相跳转的登录与注册

 2012-10-08 13:46:41 来源:WEB开发网   
核心提示:Session["Hobby"] = str;Session["Emain"] = Email.Text;Session["Birthday"] = Birthday.Text;Session["img"] = "upload/&
Session["Hobby"] = str;
Session["Emain"] = Email.Text;
Session["Birthday"] = Birthday.Text;
Session["img"] = "upload/" + filename;
Session["BriefIntroduction"] = BriefIntroduction.Text;
}
protected void username_TextChanged(object sender, EventArgs e)
{
using (SqlConnection conn = new SqlConnection(sqlserverstr))
{
conn.Open();
using (SqlCommand cmd = conn.CreateCommand())
{
cmd.CommandText = "select * from Mebiuss where UserName=@UserName";
cmd.Parameters.Add(new SqlParameter("UserName", username.Text));
using (SqlDataReader reader = cmd.ExecuteReader())
{
if (reader.Read())
{
Label1.Text = "用户名已存在,请重新输入!";

}
else { Label1.Text = "此用户名可以注册!"; }
}
}
}
}
}
}
WebWelcome.aspx:
<%@ Page Xlanguage="C#" AutoEventWireup="true" CodeBehind="WebWelcome.aspx.cs" Inherits="Webdenglu.WebWelcome" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" runat="server" Text="欢迎登陆!!!!!!!!"></asp:Label>

</div>
</form>
</body>
</html>
WebFanKui.aspx:
<%@ Page Xlanguage="C#" AutoEventWireup="true" CodeBehind="WebFanKui.aspx.cs" Inherits="Webdenglu.WebFanKui" %>

<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div id="divResult" runat="server" style="margin:0 auto; border:1px solid red">
<table >
<tr><td>用户名:</td><td><asp:Label ID="username" runat="server" Text=""></asp:Label></td></tr>
<tr><td>密 码:</td><td><asp:Label ID="Password" runat="server" Text=""></asp:Label></td></tr>
<tr><td>性 别:</td><td><asp:Label ID="sex" runat="server" Text=""></asp:Label></td></tr>
<tr><td>爱 好:</td><td><asp:Label ID="hobby" runat="server" Text=""></asp:Label></td></tr>
<tr><td>邮 箱:</td><td><asp:Label ID="Email" runat="server" Text=""></asp:Label></td></tr>

上一页  1 2 3 4 5 6  下一页

Tags:aspx 制作 链接

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接