📄 dialogdelete.cpp
字号:
// DialogDelete.cpp : implementation file
//
#include "stdafx.h"
#include "Student.h"
#include "DialogDelete.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDialogDelete dialog
CDialogDelete::CDialogDelete(CWnd* pParent /*=NULL*/)
: CDialog(CDialogDelete::IDD, pParent)
{
//{{AFX_DATA_INIT(CDialogDelete)
m_deleName = _T("");
m_deleNum = _T("");
//}}AFX_DATA_INIT
}
void CDialogDelete::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDialogDelete)
DDX_Text(pDX, IDC_EDIT_DELENAME, m_deleName);
DDX_Text(pDX, IDC_EDIT_DELENUM, m_deleNum);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDialogDelete, CDialog)
//{{AFX_MSG_MAP(CDialogDelete)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDialogDelete message handlers
void CDialogDelete::OnOK()
{
// TODO: Add extra validation here
UpdateData(TRUE);
CString strdeleNum,strdeleName;
GetDlgItemText(IDC_EDIT_DELENUM,strdeleNum);
GetDlgItemText(IDC_EDIT_DELENAME,strdeleName);
SetDlgItemText(IDC_EDIT_DELENUM,_T(""));
SetDlgItemText(IDC_EDIT_DELENAME,_T(""));
if (strdeleNum.GetLength()==0&&strdeleName.GetLength()==0)
{
MessageBox("请注意添加所需的删除条件!");
return;
}
CString sql;
if(strdeleNum.GetLength()>0&&strdeleName.GetLength()>0)
{
sql.Format("delete from student where STU_NUM='%s' and STU_NAME='%s' ",strdeleNum,strdeleName);
}
if (strdeleNum.GetLength()>0&&strdeleName.GetLength()==0)
{
sql.Format("delete from student where STU_NUM='%s'",strdeleNum);
}
if (strdeleNum.GetLength()==0&&strdeleName.GetLength()>0)
{
sql.Format("delete from student where STU_NAME='%s'",strdeleName);
}
theApp.m_ado.ExeNoneQureSql(sql);
//CDialog::OnOK();
}
void CDialogDelete::OnCancel()
{
// TODO: Add extra cleanup here
CDialog::OnCancel();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -