-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathDelEmpDlg.cpp
66 lines (55 loc) · 1.58 KB
/
DelEmpDlg.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// DelEmpDlg.cpp : implementation file
//
#include "stdafx.h"
#include "Bank.h"
#include "DelEmpDlg.h"
#include "ADOConn.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDelEmpDlg dialog
CDelEmpDlg::CDelEmpDlg(CWnd* pParent /*=NULL*/)
: CDialog(CDelEmpDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CDelEmpDlg)
m_EmployeeID = _T("");
//}}AFX_DATA_INIT
}
void CDelEmpDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDelEmpDlg)
DDX_Text(pDX, IDC_EMPLOYEEID, m_EmployeeID);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDelEmpDlg, CDialog)
//{{AFX_MSG_MAP(CDelEmpDlg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDelEmpDlg message handlers
void CDelEmpDlg::OnOK()
{
// TODO: Add extra validation here
UpdateData();
CADOConn m_ADOConn;
m_ADOConn.OnInitADOConn(); //打开数据库连接
_RecordsetPtr m_pRecordset;//定义记录集指针
_bstr_t empSQL="Select * from employee where employee_id='"+m_EmployeeID+"'";
m_pRecordset=m_ADOConn.GetRecordset(empSQL);
if(m_pRecordset->adoEOF) //入股记录集是空的
{
MessageBox("账号不存在");
GetDlgItem(IDC_EMPLOYEEID)->SetWindowText("");
return;
}
_bstr_t delSQL="delete from works_for where worker_employee_id='"+m_EmployeeID+"'";
_bstr_t deldelSQL="delete from employee where employee_id='"+m_EmployeeID+"'";
m_ADOConn.ExecuteSQL(delSQL);
m_ADOConn.ExecuteSQL(deldelSQL);
AfxMessageBox("删除成功!");
CDialog::OnOK();
}