fpassword.cs
来自「 一个用C#编写的图书管系统」· CS 代码 · 共 92 行
CS
92 行
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace Library
{
public partial class fPassword : Form
{
//属性
#region 用来实现单例模式
private static fPassword instance = null;
public static fPassword Instance
{
get
{
if (instance == null)
{
instance = new fPassword();
}
return instance;
}
}
private fPassword()
{
InitializeComponent();
instance = this;
}
private void fPassword_FormClosed(object sender, FormClosedEventArgs e)
{
instance = null;
}
#endregion
//窗体首次加载时
private void btCancel_Click(object sender, EventArgs e)
{
Close();
}
private void btnOK_Click(object sender, EventArgs e)
{
string sql = "select ReaderPassword from Reader where ReaderXueHao= '" + tbUsername.Text + "'";
DataSet ds = Library.ExecuteDataSet(sql);
if (ds.Tables.Count > 0)
{
if (ds.Tables[0].Rows[0]["ReaderPassword"].ToString() == tbPassword.Text)
{
if (tbNewpassword.Text == tbOK.Text)
{
string sql1 = "UPDATE Reader set ReaderPassword= '" + tbOK.Text + "'where ReaderXueHao= '" + tbUsername.Text + "'";
Library.ExecuteNoQuery(sql1);
MessageBox.Show("操作成功!", "系统提示:", MessageBoxButtons.OK, MessageBoxIcon.Information);
Close();
}
else
{
MessageBox.Show("输入的新密码与确认密码不符!", "系统提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
tbPassword.Focus();
}
}
}
else
{
MessageBox.Show("输入的密码不正确!", "友好提示:");
tbPassword.Focus();
}
}
private void fPassword_Load(object sender, EventArgs e)
{
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?