简单控制界面与SQL链接并增删改查,缺少mysql数据库education,可参考其逻辑

#include "stdafx.h"#include "MainWnd.h"#include "MyApp.h"#include "AddStu.h"#include "DelStu.h"#include "QueryStu.h"

// CMainWnd

IMPLEMENT_DYNCREATE(CMainWnd, CFrameWnd)

CMainWnd::CMainWnd(){

}

CMainWnd::~CMainWnd(){}

BEGIN_MESSAGE_MAP(CMainWnd, CFrameWnd) ON_WM_CREATE() ON_COMMAND(IDM_EXIT, &CMainWnd::OnExit) ON_COMMAND(IDM_ADDSTU, &CMainWnd::OnAddstu) ON_COMMAND(40004, &CMainWnd::On40004) ON_COMMAND(40005, &CMainWnd::On40005)END_MESSAGE_MAP()

// CMainWnd 消息处理程序

int CMainWnd::OnCreate(LPCREATESTRUCT lpCreateStruct){ if (CFrameWnd::OnCreate(lpCreateStruct) == -1) return -1;

// TODO: 在此添加您专用的创建代码 //将菜单资源与菜单对象绑定 menu.LoadMenuW((LPCTSTR)IDR_MENU1); //将菜单与主窗口绑定 this->SetMenu(&menu); return 0;}

void CMainWnd::OnExit(){ AfxGetApp()->PostThreadMessage(WM_QUIT,0,0);}

void CMainWnd::OnAddstu(){ CAddStu mDlg; mDlg.DoModal();}

void CMainWnd::On40004(){ CDelStu mDlg; mDlg.DoModal();}

void CMainWnd::On40005(){ CQueryStu mDlg; mDlg.DoModal();}