⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 zhuxiao.cpp

📁 一个简单的银行管理程序 VC++实现
💻 CPP
字号:
// Zhuxiao.cpp : implementation file
//

#include "stdafx.h"
#include "BankSystem.h"
#include "Zhuxiao.h"
#include "BankSystemDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CZhuxiao dialog


CZhuxiao::CZhuxiao(CWnd* pParent /*=NULL*/)
	: CDialog(CZhuxiao::IDD, pParent)
{
	//{{AFX_DATA_INIT(CZhuxiao)
	m_strUser = _T("");
	m_strPassW = _T("");
	//}}AFX_DATA_INIT
}


void CZhuxiao::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CZhuxiao)
	DDX_Text(pDX, IDC_EDIT1, m_strUser);
	DDX_Text(pDX, IDC_EDIT2, m_strPassW);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CZhuxiao, CDialog)
	//{{AFX_MSG_MAP(CZhuxiao)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CZhuxiao message handlers

void CZhuxiao::OnOK() 
{
	// TODO: Add extra validation here

	UpdateData(true);

	CBankSystemApp *App = (CBankSystemApp*)AfxGetApp();
	CBankSystemDlg *m_pMain = (CBankSystemDlg*)App->m_pMainWnd;

	_RecordsetPtr    m_pRec;
	_ConnectionPtr  m_pCon;

	CString  strSQL,m_strRealPassW;
	strSQL = "SELECT * FROM Acount where 账号=";
	strSQL+= m_strUser;

	m_pCon = m_pMain->m_pConnection;	
	m_pRec.CreateInstance(__uuidof(Recordset));
	m_pRec->Open(_variant_t(strSQL),m_pCon.GetInterfacePtr(),adOpenDynamic,adLockOptimistic,adCmdText);
	if(m_pRec->adoEOF)
	{
		AfxMessageBox("账户不存在!");
		m_pRec->Close();
		return;
	}
	m_strRealPassW = (LPCSTR)_bstr_t(m_pRec->GetCollect("密码"));
	if(m_strRealPassW!=m_strPassW)
	{
		AfxMessageBox("密码错误!");
		m_pRec->Close();
		return;
	}
	
	m_pRec->Delete(adAffectCurrent);

	m_pRec->Update();
	m_pRec->Close();		
	CDialog::OnOK();
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -