dialogupdata.cpp

来自「vc++ 利用ADO访问MYSQL数据」· C++ 代码 · 共 77 行

CPP
77
字号
// DialogUpdata.cpp : implementation file
//

#include "stdafx.h"
#include "Student.h"
#include "DialogUpdata.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CDialogUpdata dialog


CDialogUpdata::CDialogUpdata(CWnd* pParent /*=NULL*/)
	: CDialog(CDialogUpdata::IDD, pParent)
{
	//{{AFX_DATA_INIT(CDialogUpdata)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void CDialogUpdata::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDialogUpdata)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CDialogUpdata, CDialog)
	//{{AFX_MSG_MAP(CDialogUpdata)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDialogUpdata message handlers

void CDialogUpdata::OnOK() 
{
	// TODO: Add extra validation here
	UpdateData(TRUE);
	CString strupnum,strupchinese,strupmaths,strupenglish,strupphyics,strupchemistry;
	GetDlgItemText(IDC_EDIT_UPNUM,strupnum);
    GetDlgItemText(IDC_EDIT_UPMATH,strupmaths);
	GetDlgItemText(IDC_EDIT_UPCHINESE,strupchinese);
	GetDlgItemText(IDC_EDIT_UPCHEMISTRY,strupchemistry);
	GetDlgItemText(IDC_EDIT_UPENGLISH,strupenglish);
	GetDlgItemText(IDC_EDIT_UPPHYSIC,strupphyics);
	SetDlgItemText(IDC_EDIT_UPCHINESE,_T(""));
    SetDlgItemText(IDC_EDIT_UPMATH,_T(""));
	SetDlgItemText(IDC_EDIT_UPENGLISH,_T(""));
	SetDlgItemText(IDC_EDIT_UPCHEMISTRY,_T(""));
	SetDlgItemText(IDC_EDIT_UPPHYSIC,_T(""));
	if (strupnum.GetLength()==0)
	{
		MessageBox("请添加学生的学号!");
		return;
	}
	CString sql;
	sql.Format("update student set STU_CHINESE='%s',STU_MATHS='%s',STU_ENGLISH='%s',STU_PHYSICS='%s',STU_CHEMISTRY='%s' where STU_NUM='%s' ",
		strupchinese,strupmaths,strupenglish,strupphyics,strupchemistry,strupnum);
	theApp.m_ado.ExeNoneQureSql(sql);
//	CDialog::OnOK();
}

void CDialogUpdata::OnCancel() 
{
	// TODO: Add extra cleanup here
	
	CDialog::OnCancel();
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?