📄 unit9.cpp
字号:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit9.h"
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm9 *Form9;
//---------------------------------------------------------------------------
__fastcall TForm9::TForm9(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm9::BitBtn2Click(TObject *Sender)
{
LabeledEdit1->Text="";
LabeledEdit2->Text="";
LabeledEdit3->Text="";
}
//---------------------------------------------------------------------------
void __fastcall TForm9::BitBtn1Click(TObject *Sender)
{
Query1->Close();
Query1->SQL->Clear();
AnsiString strSQL="select password from Users ";
strSQL+="where user_name='"+Label1->Caption+"'";
Query1->SQL->Add(strSQL);
Query1->Prepare();
Query1->Open();
if(Query1->FieldByName("password")->AsString!=LabeledEdit1->Text)
{ //旧密码错误
MessageBox(Handle,"请重新输入","密码错误",MB_OK);
}
else if(LabeledEdit2->Text==LabeledEdit3->Text)//修改密码
{
Query1->Close();
Query1->SQL->Clear();
strSQL="update Users set password='"+LabeledEdit2->Text+"'";
strSQL+=" where user_name='"+Label1->Caption+"'";
Query1->SQL->Add(strSQL);
Query1->Prepare();
//Query1->Open();
ShowMessage("密码修改成功!");
}
else
{
MessageBox(Handle,"密码不一至!","信息提示",MB_OK);
}
}
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -