header.ascx.cs
来自「这是asp.net^和Visual C++Sharp编写的串并口通讯的书籍 源代」· CS 代码 · 共 59 行
CS
59 行
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class UseControls_Header : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnOK_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection("Server=(local);database=mrdb;Uid=sa;Pwd=");
SqlCommand myCommand = new SqlCommand("select count(*) from UserData where loginName=@loginName and loginPwd=@loginPwd", con);
myCommand.Parameters.Add(new SqlParameter("@loginName", SqlDbType.NVarChar, 20));
myCommand.Parameters["@loginName"].Value = txtUid.Text;
myCommand.Parameters.Add(new SqlParameter("@loginPwd", SqlDbType.NVarChar, 20));
myCommand.Parameters["@loginPwd"].Value = txtPwd.Text;
con.Open();
int i = Convert.ToInt32(myCommand.ExecuteScalar());
con.Close();
if (i > 0)
{
if (txtVali.Text == Session["CheckCode"].ToString())
{
Response.Write("<script>alert('登录成功!!!')</script>");
}
else
{
Response.Write("<script>alert('验证码输入错误!!!!')</script>");
}
}
else
{
Response.Write("<script>alert('用户名称或密码错误!!!!')</script>");
}
}
//protected void ImageButton2_Click(object sender, ImageClickEventArgs e)
//{
// this.txtUid.Text = "";
// this.txtPwd.Text = "";
//}
protected void btnReg_Click(object sender, EventArgs e)
{
Response.Redirect("BbsEnrol.aspx");
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?