前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >.net 登陆代码

.net 登陆代码

作者头像
Tony老师
发布2020-03-05 11:20:25
7550
发布2020-03-05 11:20:25
举报
文章被收录于专栏:托老师

    protected void Button1_Click(object sender, EventArgs e)     {         string myconnectionstring = System.Configuration.ConfigurationManager.AppSettings["connstr"];         string mycommandstring = "SELECT * FROM who where who_name=" + "’" + TextBox1.Text + "’" + "and who_pwd = " + "’" + TextBox2.Text+ "’";         SqlConnection myconnection = new SqlConnection(myconnectionstring);         SqlCommand mycommand = new SqlCommand(mycommandstring, myconnection);         myconnection.Open();         SqlDataReader myreader = mycommand.ExecuteReader();         if (myreader.Read())         {           Session["name"] = myreader["who_name"].ToString();           Response.Redirect("postdoing.aspx");         }         else         {             Response.Write("<script>alert(‘用户名或密码不正确,请重新登陆’);</script>");             Response.Redirect("login.aspx");         }     }

    protected void Button2_Click(object sender, EventArgs e)     {         TextBox1.Text = TextBox2.Text = "";     }

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2007-11-08,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档