📄 edit_mark.cpp
字号:
// edit_mark.cpp : implementation file
//
#include "stdafx.h"
#include "LMTS.h"
#include "edit_mark.h"
#include "student_db.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// edit_mark dialog
edit_mark::edit_mark(CWnd* pParent /*=NULL*/)
: CDialog(edit_mark::IDD, pParent)
{
//{{AFX_DATA_INIT(edit_mark)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void edit_mark::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(edit_mark)
DDX_Text(pDX, IDC_EDIT1, name);
DDX_Text(pDX, IDC_EDIT2, course);
DDX_Text(pDX,IDC_EDIT3,mark);// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(edit_mark, CDialog)
//{{AFX_MSG_MAP(edit_mark)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// edit_mark message handlers
void edit_mark::OnOK()
{
AfxEnableControlContainer();
// TODO: Add extra validation here
CString get_name,get_course,get_mark,str,strSQL,new_mark;
GetDlgItem(IDC_EDIT1)->GetWindowText(get_name);
GetDlgItem(IDC_EDIT2)->GetWindowText(get_course);
GetDlgItem(IDC_EDIT3)->GetWindowText(get_mark);
GetDlgItem(IDC_EDIT4)->GetWindowText(new_mark);
student_db edit_mark_db(&emd);
str.Format("select * from student where name='%s' and course='%s'",get_name,get_course);
edit_mark_db.Open(AFX_DB_USE_DEFAULT_TYPE,str);
strSQL.Format("update student set mark='%s' where name='%s' and course='%s'",new_mark,get_name,get_course);
emd.ExecuteSQL(strSQL);
emd.Close();
CDialog::OnOK();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -