C# 初学者,写了这个点击事件,可是账号密码输入正确以后点击以后什么事都没有发生啊,在线求解答,急啊!!!!谢谢啊!!!

using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;


public partial class index : System.Web.UI.Page
{
    private static string connString = "Data Source=192.168.1.112;Initial Catalog=MaxsysHelpCenter;User ID=maxsys;Password=a123456789~";
    protected void BtnLogin_Click(object sender, EventArgs e)
    {
        using (SqlConnection conn = new SqlConnection(connString))
        {
            if (conn.State != ConnectionState.Open)
                conn.Open();
            var cmd = new SqlCommand("select * from T_index_land where S_UserName=‘this.txtUserName.value‘ and S_PassWord=‘this.txtPassWrod.val‘", conn);
            using (var reader = cmd.ExecuteReader())
            {

                //判断结果。
                if (reader.HasRows)
                {

                    Response.Write("<script>alert(‘登录成功!‘);location=‘javascript:history.go(-1)‘</script>");//成功提示
                }
                else
                {
                    Response.Write("<script>alert(‘登录失败!‘);location=‘javascript:history.go(-1)‘</script>");//成功提示

                }


            }
        }
    }


    protected void Page_Load(object sender, EventArgs e)
    {
        
    }
   
}  

C# 初学者,写了这个点击事件,可是账号密码输入正确以后点击以后什么事都没有发生啊,在线求解答,急啊!!!!谢谢啊!!!

上一篇:20.C#LINQ基础和简单使用(十一章11.1-11.2)


下一篇:RDIFramework.NET开发实例━表约束条件权限的使用-WinForm