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

📄 editpassword.aspx.cs

📁 程序学生信息管理系统(SQL2000+ASP.NET+c#+)
💻 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;
using SMS;

public partial class Default2 : System.Web.UI.Page
{
    OPDataBase op = new OPDataBase();
   
    protected void Page_Load(object sender, EventArgs e)
    {
       TextBox4 .Text = Session["UserID"]+":你好!";
    }
    protected void Button3_Click(object sender, EventArgs e)
    {
        //SqlConnection conn = new SqlConnection( op .getConnection ());
        //conn.Open();
        string test = TextBox3.Text.Trim();
        string sql = "select Password from Users where  UserID='" +Session ["UserID"] + "'and Password='"+test +"'";
        SqlDataReader dr;

        dr = op.getDataReader(sql);
        if (dr.Read())

        {

            Panel1.Visible = true;
            Label2.Text = "";

        }
        else
        {
         
          
            TextBox3 .Text ="";
            Panel1.Visible = false;
           
        }

        TextBox1.Focus();


    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (TextBox1.Text == TextBox2.Text&&TextBox1.Text !=""||TextBox2 .Text !="")
        {
            string sql = " Update Users set Password='" + TextBox2.Text.Trim() + "'";
           SqlConnection conn = op.sqlConnection();
           conn.Open();
           SqlCommand cmd = new SqlCommand(sql ,conn );
           try
           {
               cmd.ExecuteNonQuery();
               Label2.Text = "*修改成功!*";
               Panel1.Visible = false; 
             
           }
           catch
           {
               Label2.Text = "*修改失败!*";
           }
         
        
        
        }
    }

    protected void Button4_Click(object sender, EventArgs e)
    {
        TextBox3.Text = "";
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        Response.Redirect("EditStudent.aspx");
    }
}

⌨️ 快捷键说明

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