📄 userregdlg.cpp
字号:
// USERRegDlg.cpp : 实现文件
//
#include "stdafx.h"
#include "MyZone.h"
#include "USERRegDlg.h"
#include ".\userregdlg.h"
// USERRegDlg 对话框
IMPLEMENT_DYNAMIC(USERRegDlg, CDialog)
USERRegDlg::USERRegDlg(CWnd* pParent /*=NULL*/)
: CDialog(USERRegDlg::IDD, pParent)
, m_Reguser(_T(""))
, m_Regname(_T(""))
, m_Regpwd(_T(""))
, m_max(_T(""))
, m_left(_T(""))
{
}
USERRegDlg::~USERRegDlg()
{
}
void USERRegDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Text(pDX, IDC_EDIT1, m_Reguser);
DDX_Text(pDX, IDC_EDIT2, m_Regname);
DDX_Text(pDX, IDC_EDIT3, m_Regpwd);
}
BEGIN_MESSAGE_MAP(USERRegDlg, CDialog)
ON_BN_CLICKED(IDOK, OnBnClickedOk)
END_MESSAGE_MAP()
// USERRegDlg 消息处理程序
void USERRegDlg::OnBnClickedOk()
{
// TODO: 在此添加控件通知处理程序代码
OnOK();
CString str;
GetDlgItemText(IDC_EDIT1,m_Reguser);
GetDlgItemText(IDC_EDIT2,m_Regname);
GetDlgItemText(IDC_EDIT3,m_Regpwd);
int j;
int i=atoi(m_Reguser);
if(i>2000000000)
{j=10;m_max.Format("%d",j);}
else
{j=5;m_max.Format("%d",j);}
if(m_Reguser == ""||m_Regname == "" || m_Regpwd == "")
{
AfxMessageBox("用户名,姓名和密码不能为空!");
}
else
try
{
theApp.m_pRecordsetreg->Open("select * from Reader",
theApp.m_pConnection.GetInterfacePtr(),
adOpenDynamic,adLockOptimistic,adCmdText);
theApp.m_pRecordsetreg->AddNew();
theApp.m_pRecordsetreg->PutCollect("Name", _variant_t(m_Regname));
theApp.m_pRecordsetreg->PutCollect("Password", _variant_t(m_Regpwd));
theApp.m_pRecordsetreg->PutCollect("SID",_variant_t(m_Reguser));
theApp.m_pRecordsetreg->PutCollect("MaxNum",_variant_t(m_max));
theApp.m_pRecordsetreg->PutCollect("BLeft",_variant_t(m_max));
theApp.m_pRecordsetreg->Update();
AfxMessageBox("注册成功!");
theApp.m_pRecordsetreg->Close();
}
catch(_com_error e){
CString errormessage;
errormessage.Format("数据库注册表项操作失败!\r\n%s",e.Description());
MessageBox(e.Description());
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -