?? employeectrl.cpp
字號:
// Employeectrl.cpp : implementation file
//
#include "stdafx.h"
#include "SQL.h"
#include "Employeectrl.h"
#include "Boss.h"
#include "Empolyee.h"
#include "Dtatabaseset.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CEmployeectrl dialog
CEmployeectrl::CEmployeectrl(CWnd* pParent /*=NULL*/)
: CDialog(CEmployeectrl::IDD, pParent)
{
//{{AFX_DATA_INIT(CEmployeectrl)
m_eage = _T("");
m_contract = _T("");
m_eduty = _T("");
m_eno = _T("");
m_eother = _T("");
m_esex = _T("");
m_sector = _T("");
m_name = _T("");
//}}AFX_DATA_INIT
}
void CEmployeectrl::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CEmployeectrl)
DDX_Text(pDX, IDC_EAGE, m_eage);
DDX_Text(pDX, IDC_ECONTRACT, m_contract);
DDX_Text(pDX, IDC_EDUTY, m_eduty);
DDX_Text(pDX, IDC_ENO, m_eno);
DDX_Text(pDX, IDC_EOTHER, m_eother);
DDX_Text(pDX, IDC_ESEX, m_esex);
DDX_Text(pDX, IDC_SECTOR, m_sector);
DDX_Text(pDX, IDC_NAME, m_name);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CEmployeectrl, CDialog)
//{{AFX_MSG_MAP(CEmployeectrl)
ON_BN_CLICKED(IDC_BUTTON1, OnADD)
ON_BN_CLICKED(IDC_BUTTON4, OnDelete)
ON_BN_CLICKED(IDC_BUTTON6, OnChange)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CEmployeectrl message handlers
void CEmployeectrl::OnADD()
{
// TODO: Add your control notification handler code here
UpdateData(true);
CDatabaseset m_employ(&m_db);
CString str;
str = "select * from Employee";
if (!m_employ.Open(CRecordset::dynaset,str)) {
AfxMessageBox("數據庫打開失敗!");
return;
}
m_employ.AddNew();
m_employ.m_Eno = m_eno;
m_employ.m_Econtract = m_contract;
m_employ.m_Eduty = m_eduty;
m_employ.m_Eage = m_eage;
m_employ.m_Ename = m_name;
m_employ.m_Eother = m_eother;
m_employ.m_Esector = m_sector;
m_employ.m_Esex = m_esex;
m_employ.Update();
AfxMessageBox("修改成功!請退出!");
}
void CEmployeectrl::OnDelete()
{
// TODO: Add your control notification handler code here
UpdateData(true);
CDatabaseset m_employ(&m_db);
CString str;
str.Format("select * from Employee where Eno = '%s'",m_eno);
if (!m_employ.Open(CRecordset::dynaset,str)) {
AfxMessageBox("數據庫代開失敗!");
return;
}
m_employ.Delete();
m_employ.Close();
AfxMessageBox("修改成功!請退出!");
}
void CEmployeectrl::OnChange()
{
// TODO: Add your control notification handler code here
UpdateData(true);
CDatabaseset m_employ(&m_db);
CString str;
str.Format("select * from Employee where Eno = '%s'",m_eno);
if (!m_employ.Open(CRecordset::dynaset,str)) {
AfxMessageBox("數據庫打開失?。?quot;);
return;
}
m_employ.Edit();
m_employ.m_Eno = m_eno;
if (!m_contract.IsEmpty()) {
m_employ.m_Econtract = m_contract;
}
if (!m_eduty.IsEmpty()) {
m_employ.m_Eduty = m_eduty;
}
if (!m_eage.IsEmpty()) {
m_employ.m_Eage = m_eage;
}
if (!m_name.IsEmpty()) {
m_employ.m_Ename = m_name;
}
if (!m_eother.IsEmpty()) {
m_employ.m_Eother = m_eother;
}
if (!m_sector.IsEmpty()) {
m_employ.m_Esector = m_sector;
}
if (!m_esex.IsEmpty()) {
m_employ.m_Esex = m_esex;
}
m_employ.Update();
AfxMessageBox("修改成功!請退出!");
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -