?? class_mimagenggai.aspx.cs
字號:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
namespace free
{
/// <summary>
/// Summary description for class_mimagenggai.
/// </summary>
public class class_mimagenggai : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label name;
protected System.Web.UI.HtmlControls.HtmlTable jiaocheng;
protected System.Web.UI.WebControls.TextBox TextBox1;
protected System.Web.UI.WebControls.TextBox TextBox2;
protected System.Web.UI.WebControls.Button Button1;
protected System.Web.UI.WebControls.Button Button2;
protected System.Web.UI.WebControls.TextBox TextBox3;
protected System.Data.SqlClient.SqlConnection myconn;
protected System.Web.UI.WebControls.Label tishi;
protected System.Web.UI.WebControls.RegularExpressionValidator RegularExpressionValidator1;
protected System.Data.SqlClient.SqlCommand mycomm;
private void Page_Load(object sender, System.EventArgs e)
{
name.Text=Request.Cookies["free_xueyuan"].Value.ToString();
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Button1.Click += new System.EventHandler(this.Button1_Click);
this.Button2.Click += new System.EventHandler(this.Button2_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void Button2_Click(object sender, System.EventArgs e)
{
Response.Redirect("class_study.aspx");
}
private void Button1_Click(object sender, System.EventArgs e)
{
if(TextBox1.Text.Trim()=="")
{
tishi.Text="新密碼不能為空!";
}
else if(TextBox2.Text.Trim()!=TextBox3.Text.Trim())
{
tishi.Text="新密碼不一致!";
}
else if(Page.IsValid)
{
string sqlstr="SELECT stu_password FROM class_student_information where stu_name='"+Request.Cookies["free_xueyuan"].Value.ToString()+"' ";
myconn=new SqlConnection(Session["str_connection"].ToString());
myconn.Open();
//Try
mycomm=new SqlCommand(sqlstr,myconn);
SqlDataReader myread=mycomm.ExecuteReader();
myread.Read();
if(TextBox1.Text.Trim()==myread["stu_password"].ToString().Trim() )
{
myread.Close();
mycomm=new SqlCommand("update class_student_information set stu_password='"+TextBox2.Text.Trim()+"' where stu_name='"+Request.Cookies["free_xueyuan"].Value.ToString()+"'",myconn);
mycomm.ExecuteNonQuery();
tishi.Text="密碼修改成功!";
}
else
{
tishi.Text="舊密碼錯誤!";
}
myconn.Close();
}
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -