码迷,mamicode.com
首页 > Windows程序 > 详细

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

时间:2015-01-13 21:23:58      阅读:257      评论:0      收藏:0      [点我收藏+]

标签:

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

标签:

原文地址:http://www.cnblogs.com/l0veD0jie/p/4222273.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!