📄 marridialog.cpp
字号:
// MarriDialog.cpp : implementation file
//
#include "stdafx.h"
#include "EmpMan.h"
#include "MarriDialog.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMarriDialog dialog
CMarriDialog::CMarriDialog(CWnd* pParent /*=NULL*/)
: CDialog(CMarriDialog::IDD, pParent)
{
//{{AFX_DATA_INIT(CMarriDialog)
m_name = _T("");
m_workplace = _T("");
//}}AFX_DATA_INIT
}
void CMarriDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CMarriDialog)
DDX_Text(pDX, IDC_EDIT_NAME, m_name);
DDX_Text(pDX, IDC_EDIT_WORK, m_workplace);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CMarriDialog, CDialog)
//{{AFX_MSG_MAP(CMarriDialog)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMarriDialog message handlers
void CMarriDialog::SelectSQL()
{
CRecordset rs(&db);
CString sql,sql2;
//sql.Format("select * From ewh Where eID= %s",id);
sql="select * From ewh ";
sql2.Format("Where eID= %s",id);
sql=sql+sql2;
rs.Open(CRecordset::forwardOnly,sql);
if (rs.IsEOF())
{
MessageBox("请输入你的爱人信息");
havemarriaged=false;
}
if(!rs.IsEOF()) // 非空则获取员工信息
{
rs.GetFieldValue("ewhname",m_name);
rs.GetFieldValue("workplace",m_workplace);
}
rs.Close();
UpdateData(false);
}
BOOL CMarriDialog::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
havemarriaged =true;
SelectSQL();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CMarriDialog::OnOK()
{
// TODO: Add extra validation here
UpdateData(true);
CString sql;
if(havemarriaged)
{
sql.Format("delete from ewh where eID=%s",id);
db.ExecuteSQL(sql);
}
sql.Format("insert into ewh Values (%s,'%s','%s')",id,m_name,m_workplace);
db.ExecuteSQL(sql);
CDialog::OnOK();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -