📄 addressinput.cpp
字号:
// AddressInput.cpp : implementation file
//
#include "stdafx.h"
#include "PIM.h"
#include "AddressInput.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CAddressInput dialog
CAddressInput::CAddressInput(CWnd* pParent /*=NULL*/)
: CDialog(CAddressInput::IDD, pParent)
{
//{{AFX_DATA_INIT(CAddressInput)
m_sAddress = _T("");
m_sCellphone = _T("");
m_sCounty = _T("");
m_sEmail = _T("");
m_sName = _T("");
m_sPostcode = _T("");
m_sProvince = _T("");
m_sSex = _T("");
m_sTelphone = _T("");
m_cBirthday = COleDateTime::GetCurrentTime();
//}}AFX_DATA_INIT
}
void CAddressInput::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAddressInput)
DDX_Text(pDX, IDC_ADDRESS, m_sAddress);
DDX_Text(pDX, IDC_CELLPHONE, m_sCellphone);
DDX_Text(pDX, IDC_COUNTY, m_sCounty);
DDX_Text(pDX, IDC_EMAIL, m_sEmail);
DDX_Text(pDX, IDC_NAME, m_sName);
DDX_Text(pDX, IDC_POSTCODE, m_sPostcode);
DDX_Text(pDX, IDC_PROVINCE, m_sProvince);
DDX_Text(pDX, IDC_SEX, m_sSex);
DDX_Text(pDX, IDC_TELPHONE, m_sTelphone);
DDX_DateTimeCtrl(pDX, IDC_BIRTHDAY, m_cBirthday);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAddressInput, CDialog)
//{{AFX_MSG_MAP(CAddressInput)
ON_BN_CLICKED(IDC_RESET, OnReset)
ON_BN_CLICKED(IDC_ADD, OnAdd)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CAddressInput message handlers
void CAddressInput::OnReset()
{
// TODO: Add your control notification handler code here
m_sAddress = _T("");
m_cBirthday = COleDateTime::GetCurrentTime();
m_sCellphone = _T("");
m_sCounty = _T("");
m_sEmail = _T("");
m_sName = _T("");
m_sPostcode = _T("");
m_sProvince = _T("");
m_sSex = _T("");
m_sTelphone = _T("");
UpdateData(false);
}
void CAddressInput::OnAdd()
{
// TODO: Add your control notification handler code here
UpdateData(true);
_variant_t Holder, strQuery;
strQuery = "select * from 通讯录";
theApp.ADOExecute(theApp.m_pADOSet, strQuery);
theApp.m_pADOSet->AddNew();
theApp.m_pADOSet->PutCollect("名字",_variant_t(LPCTSTR(m_sName)));
theApp.m_pADOSet->PutCollect("性别",_variant_t(LPCTSTR(m_sSex)));
theApp.m_pADOSet->PutCollect("地址",_variant_t(LPCTSTR(m_sAddress)));
theApp.m_pADOSet->PutCollect("市\/县",_variant_t(LPCTSTR(m_sCounty)));
theApp.m_pADOSet->PutCollect("移动电话",_variant_t(LPCTSTR(m_sCellphone)));
theApp.m_pADOSet->PutCollect("省\/市\/自治区",_variant_t(LPCTSTR(m_sProvince)));
theApp.m_pADOSet->PutCollect("邮政编码",_variant_t(LPCTSTR(m_sPostcode)));
theApp.m_pADOSet->PutCollect("电子邮件地址",_variant_t(LPCTSTR(m_sEmail)));
theApp.m_pADOSet->PutCollect("固定电话",_variant_t(LPCTSTR(m_sTelphone)));
theApp.m_pADOSet->PutCollect("生日",_variant_t(LPCTSTR(m_cBirthday.Format("%Y-%m-%d "))));
// AfxMessageBox("aa");
if(theApp.m_pADOSet->Update() == S_OK);
{
AfxMessageBox("添加成功");
theApp.m_pADOSet->Close();
return;
}
//theApp.m_pADOSet->Update();
theApp.m_pADOSet->Close();
AfxMessageBox("添加失败");
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -