?? config.cs
字號:
?using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace schoolManager
{
public partial class config : Form
{
public config(string pass)
{
InitializeComponent();
oldpass = pass;
}
public string oldpass;
private void button1_Click(object sender, EventArgs e)
{
DataMessager change = new DataMessager(Application.StartupPath);
if (textBox2.Text != "" && textBox3.Text != "" && textBox4.Text != "")
{ //更新系統密碼
if (oldpass != textBox2.Text)
{
MessageBox.Show("原始密碼不匹配!","提示",MessageBoxButtons.OK,MessageBoxIcon.Error);
return;
}
string sqlstr = "update users set pass = '"+textBox3.Text+"' where id = 1";
if (change.modify(sqlstr))
{
MessageBox.Show("更新成功!");
this.DialogResult = DialogResult.Yes;
}
}
}
private void textBox4_KeyPress(object sender, KeyPressEventArgs e)
{
if (this.textBox4.Text.Trim() != this.textBox3.Text.Trim())
{
this.Text ="---密碼輸入不完整";
}
else
{
this.Text ="---密碼驗證完畢";
}
}
private void textBox2_MouseClick(object sender, MouseEventArgs e)
{
this.textBox2.Text = "";
}
private void textBox3_MouseClick(object sender, MouseEventArgs e)
{
this.textBox3.Text = "";
}
private void textBox4_MouseClick(object sender, MouseEventArgs e)
{
this.textBox4.Text = "";
}
private void button2_Click(object sender, EventArgs e)
{
this.Close();
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -