📄 punishtypedlg.cpp
字号:
// PunishTypeDlg.cpp : implementation file
//
#include "stdafx.h"
#include "Library.h"
#include "PunishTypeDlg.h"
#include "PunishTypeSet.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CPunishTypeDlg dialog
CPunishTypeDlg::CPunishTypeDlg(CWnd* pParent /*=NULL*/)
: CDialog(CPunishTypeDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CPunishTypeDlg)
m_strMoney = _T("0.1");
//}}AFX_DATA_INIT
}
void CPunishTypeDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CPunishTypeDlg)
DDX_Text(pDX, IDC_EDIT_MONEY, m_strMoney);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CPunishTypeDlg, CDialog)
//{{AFX_MSG_MAP(CPunishTypeDlg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CPunishTypeDlg message handlers
void CPunishTypeDlg::OnOK()
{
UpdateData();
//检查金额输入
if(m_strMoney.IsEmpty())
{
AfxMessageBox("请输入罚款金额");
return;
}
//构造记录集,保存数据
CPunishTypeSet rs;
CString strSQL;
strSQL="select * from punishType";
if(!rs.Open(AFX_DB_USE_DEFAULT_TYPE,strSQL))
{
MessageBox("打开数据库失败!","数据库错误",MB_OK);
return ;
}
//判断记录是否已经存在
if(rs.GetRecordCount()!=0)
{
rs.Edit();
rs.m_type = "超出罚款";
rs.m_money = m_strMoney;
rs.Update();
}
else
{
rs.AddNew();
rs.m_type = "超出罚款";
rs.m_money = m_strMoney;
rs.Update();
}
rs.Close();
CDialog::OnOK();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -