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.OleDb;
public partial class usercontrol_gmpwdl : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void change_ServerClick(object sender, EventArgs e)
    { 
        string OleDbcmd = "select userPwd from user_info where userName='" + Session["user"].ToString() + "'";
        OleDbConnection conn = DB.connstr();
        conn.Open();
        OleDbCommand cmd = new OleDbCommand(OleDbcmd, conn);
        string pwdstr = Convert.ToString(cmd.ExecuteScalar());
        if (this.oldPasswordTxt.Text == pwdstr)
        {
            string inOleDb = "update user_info set userPwd= '" + this.newPasswordTxt2.Text + "' where userName='" + Session["user"] + "'";
            OleDbCommand inscmd = new OleDbCommand(inOleDb, conn);
            inscmd.ExecuteNonQuery();
            this.successTxt.Text = "密码修改成功！";

        }
        else
        {
            this.successTxt.Text = "旧密码错误！";
        }
        conn.Close();


    }
}
