⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 midifydlg.cpp

📁 一个C++和SQL的图书管理系统 功能不多 大家可以下来
💻 CPP
字号:
// MidifyDlg.cpp : implementation file
//

#include "stdafx.h"
#include "library.h"
#include "ModifyLoadDlg.h"
#include "ReaderSet.h"
#include "MidifyDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CMidifyDlg dialog


CMidifyDlg::CMidifyDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CMidifyDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CMidifyDlg)
	m_address = _T("");
	m_age = _T("");
	m_name = _T("");
	m_other = _T("");
	m_phone = _T("");
	m_readerid = _T("");
	//}}AFX_DATA_INIT
}


void CMidifyDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CMidifyDlg)
	DDX_Text(pDX, IDC_ADDRESS, m_address);
	DDX_Text(pDX, IDC_AGE, m_age);
	DDX_Text(pDX, IDC_NAME, m_name);
	DDX_Text(pDX, IDC_OTHER, m_other);
	DDX_Text(pDX, IDC_PHONE, m_phone);
	DDX_Text(pDX, IDC_READERID, m_readerid);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CMidifyDlg, CDialog)
	//{{AFX_MSG_MAP(CMidifyDlg)
	ON_BN_CLICKED(IDOK, OnModify)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMidifyDlg message handlers

BOOL CMidifyDlg::OnInitDialog()
{
	CDialog::OnInitDialog();
	CModifyLoadDlg	dlg;
	int flg = dlg.DoModal();
	////初始化界面内容
	if(flg == IDOK)
	{
		m_readerid = dlg.m_readerid;
		m_name		=	dlg.m_name;
		m_age		=	dlg.m_age;
		m_phone		=	dlg.m_phone;
		m_address	=   dlg.m_address;
		m_other		=	dlg.m_other;
		UpdateData(false);
		return TRUE;
	}
	if( flg == IDCANCEL)
	{
		CDialog::OnOK();
	}
	return TRUE;	
}

void CMidifyDlg::OnModify() 
{
	// TODO: Add your control notification handler code here
	UpdateData();
	CReaderSet	m_readerSet;
	CString	strsql;

	strsql.Format("select * from Reader where CardID = '%s'",m_readerid);

	if(!m_readerSet.Open(AFX_DB_USE_DEFAULT_TYPE,strsql))
	{
		AfxMessageBox("连接数据库错误");
		return;
	}
	m_readerSet.Edit();
	m_readerSet.m_Name		=	m_name;
	m_readerSet.m_Age		=	m_age;
	m_readerSet.m_Phone		=	m_phone;
	m_readerSet.m_Address	=   m_address;
	m_readerSet.m_Other		=	m_other;
	if(m_readerSet.CanUpdate())
	{
		m_readerSet.Update();
		m_readerSet.Close();
		if(IDOK==MessageBox("修改成功","成功",MB_OK))
		{
			CDialog::OnOK();
		}
	}
}

⌨️ 快捷键说明

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