dbaeditdlg.cpp

来自「库存管理系统 用来管理仓库的」· C++ 代码 · 共 95 行

CPP
95
字号
// DbaEditDlg.cpp : implementation file
//

#include "stdafx.h"
#include "Stock.h"
#include "DbaEditDlg.h"
#include "DbaEditDlg.h"
#include "Connection.h"
extern CConnection * gconn;
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CDbaEditDlg dialog


CDbaEditDlg::CDbaEditDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CDbaEditDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CDbaEditDlg)
	m_name = _T("");
	m_pwd = _T("");
	m_pwdsure = _T("");
	//}}AFX_DATA_INIT
}


void CDbaEditDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDbaEditDlg)
	DDX_Text(pDX, IDC_EDIT1, m_name);
	DDX_Text(pDX, IDC_EDIT2, m_pwd);
	DDX_Text(pDX, IDC_EDIT3, m_pwdsure);
	//}}AFX_DATA_MAP
}


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

/////////////////////////////////////////////////////////////////////////////
// CDbaEditDlg message handlers

void CDbaEditDlg::OnOK() 
{
	// TODO: Add extra validation here
	UpdateData();
	if(m_name=="")
	{
	  MessageBox("请输入用户名!");
	  return;
	}
	if(m_pwd=="")
	{
	  MessageBox("请输入密码!");
	  return;
	}
	if(m_name=="")
	{
	  MessageBox("请确认密码!");
	  return;
	}
  if(m_pwd!=m_pwdsure)
  {
     MessageBox("您输入的密码不匹配,请重新输入!");
	 m_pwd="";
	 m_pwdsure="";
	 UpdateData(FALSE);
	 return;
  }

 CString sql="select * from Users where UserName= '"+m_name+"'";

 if(!gconn->Execute(sql)->adoEOF)
 {
    MessageBox("您输入的用户名已经存在,请重新输入!");
	return;
 }
 else
 {
 sql="insert into Users values('"+m_name+"','"+m_pwd+"')";
 gconn->Execute(sql);
 }



	CDialog::OnOK();
}

⌨️ 快捷键说明

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