⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 webusercontrol.ascx.cs

📁 这是asp.net^和Visual C++Sharp编写的串并口通讯的书籍 源代码
💻 CS
字号:
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 WebUserControl : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        
    }
    protected void ImageButton1_Click(object sender, ImageClickEventArgs 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 = txtName.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 (txtCheckCode.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.txtName.Text = "";
        this.txtPwd.Text = "";
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -