C# 初學者,寫了這個點擊事件,可是帳號密碼輸入正確以後點擊以後什麼事都沒有發生啊,線上求解答,急啊!!!!謝謝啊!!!

來源:互聯網
上載者:User

標籤:

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# 初學者,寫了這個點擊事件,可是帳號密碼輸入正確以後點擊以後什麼事都沒有發生啊,線上求解答,急啊!!!!謝謝啊!!!

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.