📄 mmxg.cs
字号:
}
private void button2_Click(object sender, System.EventArgs e)
{
if(this.button2.Text == "重填")
{
this.textBox1.Text="";
this.textBox2.Text="";
this.textBox3.Text="";
this.textBox4.Text="";
this.textBox1.Focus();
}
else
{
this.Close();
}
}
private void button1_Click(object sender, System.EventArgs e)
{
try
{
System.Data.OleDb.OleDbCommand MySelect = this.oleDbConnection1.CreateCommand();
MySelect.CommandText = "SELECT 用户名 FROM ygxxb WHERE 用户名='"+this.textBox1.Text+"' and 密码='"+this.textBox2.Text+"'";
this.oleDbDataAdapter1.SelectCommand = MySelect;
System.Data.OleDb.OleDbCommand MyUpdata = this.oleDbConnection1.CreateCommand();
MyUpdata.CommandText = "UPDATE ygxxb SET 密码='"+this.textBox3.Text+"' WHERE 用户名='"+this.textBox1.Text+"'";
this.oleDbDataAdapter1.UpdateCommand = MyUpdata;
if(this.textBox1.Text == "")
{
MessageBox.Show("请输入用户名!!!","修改提示:",MessageBoxButtons.OK,MessageBoxIcon.Information);
this.textBox1.Focus();
}
else
{
if(this.textBox2.Text == "")
{
MessageBox.Show("请输入当前密码,否则无权修改密码!!!","修改提示:",MessageBoxButtons.OK,MessageBoxIcon.Exclamation);
this.textBox2.Focus();
}
else
{
if(this.textBox3.Text == "")
{
MessageBox.Show("为了安全,请输入新密码!!!","修改提示:",MessageBoxButtons.OK,MessageBoxIcon.Information);
this.textBox3.Focus();
}
else
{
if(this.textBox3.Text != this.textBox4.Text)
{
MessageBox.Show("两次密码不一样!重新输入.","修改提示:",MessageBoxButtons.OK,MessageBoxIcon.Exclamation);
this.textBox4.Focus();
}
else
{
this.oleDbConnection1.Open();
int If=this.oleDbDataAdapter1.Fill(this.dataSet21,"ygxxb");
this.oleDbConnection1.Close();
if( If== 0)
{
MessageBox.Show("当前密码错误,你无权修改!!!","修改提示:",MessageBoxButtons.OK,MessageBoxIcon.Exclamation);
this.Close();
}
else
{
this.oleDbConnection1.Open();
MyUpdata.ExecuteNonQuery();
this.oleDbConnection1.Close();
MessageBox.Show("密码修改成功,请记住你的新密码.","修改提示:",MessageBoxButtons.OK,MessageBoxIcon.Information);
this.Close();
}
}
}
}
}
}
catch(Exception Exc)
{
MessageBox.Show(Exc.Message);
this.oleDbConnection1.Close();
}
}
private void button1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
int Key=(int)e.KeyCode;
switch(Key)
{
case 27:
this.Close();
break;
case 13:
this.button1_Click(null,null);
break;
case 38:
case 37:
if(this.textBox1.Focused)
{
this.button2.Focus();
}
else
{
if(this.textBox2.Focused)
{
this.textBox1.Focus();
}
else
{
if(this.textBox3.Focused)
{
this.textBox2.Focus();
}
else
{
if(this.textBox4.Focused)
{
this.textBox3.Focus();
}
else
{
if(this.button1.Focused)
{
this.textBox4.Focus();
}
else
{
if(this.button2.Focused)
{
this.button1.Focus();
}
}
}
}
}
}
break;
case 40:
case 39:
if( this.textBox1.Focused)
{
this.textBox2.Focus();
}
else
{
if( this.textBox2.Focused)
{
this.textBox3.Focus();
}
else
{
if( this.textBox3.Focused)
{
this.textBox4.Focus();
}
else
{
if( this.textBox4.Focused)
{
this.button1.Focus();
}
else
{
if(this.button1.Focused)
{
this.button2.Focus();
}
}
}
}
}
break;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -