📄 mydlg3.cpp
字号:
// MyDlg3.cpp : implementation file
//
#include "stdafx.h"
#include "bishe.h"
#include "MyDlg3.h"
#include <afxdb.h>
#include "Usefulkey.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMyDlg3 dialog
CMyDlg3::CMyDlg3(CWnd* pParent /*=NULL*/)
: CDialog(CMyDlg3::IDD, pParent)
{
//{{AFX_DATA_INIT(CMyDlg3)
m_name = _T("");
//}}AFX_DATA_INIT
}
void CMyDlg3::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CMyDlg3)
DDX_Text(pDX, IDC_NAME, m_name);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CMyDlg3, CDialog)
//{{AFX_MSG_MAP(CMyDlg3)
ON_BN_CLICKED(IDC_cercreate_BUTTON1, OncercreateBUTTON1)
ON_BN_CLICKED(IDC_exit_BUTTON1, OnexitBUTTON1)
ON_BN_CLICKED(IDC_COMPARE_BUTTON1, OnCompareButton1)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMyDlg3 message handlers
void CMyDlg3::OncercreateBUTTON1()
{
// TODO: Add your control notification handler code here
UpdateData(true);
GetDlgItemText(IDC_NAME,g_USERNAME);
if(m_name=="")
{
AfxMessageBox("未输入姓名!");
}
else
{
OnOK();
m_MyDlg4.DoModal();
}
UpdateData(false);
}
void CMyDlg3::OnexitBUTTON1()
{
// TODO: Add your control notification handler code here
OnCancel();
}
void CMyDlg3::OnCompareButton1()
{
// TODO: Add your control notification handler code here
CString name;
GetDlgItemText(IDC_NAME,name);
UpdateData();
if(name=="")
{
MessageBox("未输入姓名!","Error",MB_OK);
return;
}
CDatabase m_uDatabase;
CUsefulkey m_use(&m_uDatabase);
CString m_uRecordSet=(_T("[usefulkey]"));
m_uRecordSet.Format("select * from usefulkey where username='%s'",name);
if(!m_use.Open(AFX_DB_USE_DEFAULT_TYPE,m_uRecordSet))
{
MessageBox("打开数据库失败!","数据库错误!",MB_OK);
return;
}
if(m_use.GetRecordCount()!=0)//查到的纪录不空
{
AfxMessageBox("此姓名已使用!");
}
else
{
AfxMessageBox("此姓名可使用!");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -