.net 登录注册参考代码

.net 登录注册参考代码

ID:13906291

大小:42.50 KB

页数:4页

时间:2018-07-24

.net 登录注册参考代码_第1页
.net 登录注册参考代码_第2页
.net 登录注册参考代码_第3页
.net 登录注册参考代码_第4页
资源描述:

《.net 登录注册参考代码》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库

1、登录usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Web;usingSystem.Web.UI;usingSystem.Web.UI.WebControls;usingSystem.Xml.Linq;usingSystem.Data.SqlClient;usingSystem.Data;publicpartialclass_Default:System.Web.UI.Page{protectedvoidPage_Load(objectsender,EventArgse

2、){}protectedvoidButton1_Click(objectsender,EventArgse){stringconnectionString=@"DataSource=.SQLEXPRESS;AttachDbFilename=C:UserslenovoDesktop王ª?晓t玲¢¨¢App_DataDatabase.mdf;IntegratedSecurity=True;UserInstance=True";//创ä¡ä建¡§获?取¨?数ºy据Y库a连¢?接¨®字Á?符¤?串ä?,ê?并¡é创ä¡ä建¡§数ºy据Y库a连¢?接¨®对?象¨

3、®stringsql="selectusername,passwordfromT1whereusername='"+TextBox1.Text+"'andpassword='"+TextBox2.Text+"'";SqlConnectionconn=newSqlConnection(connectionString);//实º¦Ì例¤y化¡¥连¢?接¨®对?象¨®SqlCommandcmd=newSqlCommand(sql,conn);//执¡ä行D命¨¹令¢?conn.Open();//打䨰开a数ºy据Y库aSqlDataReaderr=cmd.Execut

4、eReader();if(r.Read())//从䨮数ºy据Y库a读¨¢取¨?用®?户¡ì信?息¡é,判D断?是º?否¤?有®D记?录?{Response.Write("");//Response.Redirect("Text.aspx");}else{//if(username.Trim()!=TextBox1.Text

6、

7、password.Trim()!=TextBox2.Text)//判D断?用®?户¡ì名?密¨¹码?是º?否¤?一°?致?{Response.Write("

8、cript>alert('用®?户¡ì名?或¨°密¨¹码?错䨪误¨®!ê?!ê?!ê?');");//Label5.Text="用®?户¡ì名?或¨°密¨¹码?错䨪误¨®,请?重?新?输º?入¨?";//Response.Redirect("login.aspx");}}//else//{//Response.Write("");//}}protectedvoidButton2_Click(objectsender,EventArgse){Respon

9、se.Redirect("Register.aspx");//转Áa到Ì?注Á¡é册¨¢页°3}}注册usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Web;usingSystem.Web.UI;usingSystem.Web.UI.WebControls;usingSystem.Xml.Linq;usingSystem.Data.SqlClient;usingSystem.Data;usingSystem.Collections;usingSystem.Configu

10、ration;usingSystem.Web.UI.HtmlControls;usingSystem.Web.UI.WebControls.WebParts;publicpartialclassDefault3:System.Web.UI.Page{protectedvoidPage_Load(objectsender,EventArgse){}protectedvoidButton1_Click(objectsender,EventArgse){if(TextBox4.Text==String.Empty){Label4.Text="请?输º?入¨?内¨²容¨

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。