using System;
using System.Data;
using System.Configuration;
using System.Collections;
public partial class XueShengMod : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
if (this.TextBox2.Text == "" || this.TextBox3.Text == "")
{
Response.Write("alert('密碼不能為空!');document.location=document.location;");
}
if
(this.TextBox1.Text!=Session["PWD"].ToString())
{
Response.Write("alert('舊密碼不對!');document.location=document.location;");
}
else if (this.TextBox2.Text == this.TextBox3.Text)
{
string sql = "update TB_XueSheng set PassWord='" + this.TextBox2.Text + "' where XueHao='" + Session["username"].ToString() + "'";
bool b = DBHelper.ExecSql(sql);
if (b)
{
未將對象引用設置到對象的實例。
源錯誤:
行 22: Response.Write("alert('密碼不能為空!');document.location=document.location;");
行 23: }
行 24: if
行 25: (this.TextBox1.Text!=Session["PWD"].ToString())
行 26: {
使用session前最好判斷下session是否為空,要不超時後session為空調用ToString就報錯了
protected void Button1_Click(object sender, EventArgs e)
{
if(Session["username"]==null||Session["pwd"]==null){/////////
Response.Write("超時!");
Response.End();///////
}
if (this.TextBox2.Text == "" || this.TextBox3.Text == "")