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

📄 journey.cpp

📁 一个自己制作的数据库文件
💻 CPP
字号:
// Journey.cpp : implementation file
//

#include "stdafx.h"
#include "Xmgl.h"
#include "Journey.h"

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

/////////////////////////////////////////////////////////////////////////////
// CJourney dialog


CJourney::CJourney(CWnd* pParent /*=NULL*/)
	: CDialog(CJourney::IDD, pParent)
{
	//{{AFX_DATA_INIT(CJourney)
	m_Enddate = 0;
	m_Startdate = 0;
	m_Charge = 0.0f;
	m_End = _T("");
	m_Item = _T("");
	m_Name = _T("");
	m_Start = _T("");
	//}}AFX_DATA_INIT
}


void CJourney::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CJourney)
	DDX_DateTimeCtrl(pDX, IDC_DATETIMEPICKER_ENDDATE, m_Enddate);
	DDX_DateTimeCtrl(pDX, IDC_DATETIMEPICKER_STARTDATE, m_Startdate);
	DDX_Text(pDX, IDC_EDIT_CHARGE, m_Charge);
	DDX_Text(pDX, IDC_EDIT_END, m_End);
	DDX_Text(pDX, IDC_EDIT_ITEM, m_Item);
	DDX_Text(pDX, IDC_EDIT_NAME, m_Name);
	DDX_Text(pDX, IDC_EDIT_START, m_Start);
	//}}AFX_DATA_MAP
}


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

/////////////////////////////////////////////////////////////////////////////
// CJourney message handlers

void CJourney::OnOK() 
{
	// TODO: Add extra validation here
	UpdateData();
	if(m_Name=="")
	{
		MessageBox("请填写姓名!");

		return;
	}
	
	if(m_Item=="")
	{
		MessageBox("请填写项目名称!");

		return;
	}

	if(	m_End=="")
	{
		MessageBox("请填写到达地点!");
		
		return;
	}

	if(	m_Start=="")
	{
		MessageBox("请填写出发地点!");
		
		return;
	}
	//打开记录集
	CString strSQL;
	strSQL="select * from xingcheng";
	if(!m_recordset.Open(AFX_DB_USE_DEFAULT_TYPE,strSQL))
	{
		MessageBox("打开数据库失败!","数据库错误",MB_OK);
		return ;
	}
		m_recordset.AddNew();
		m_recordset.m_Name = m_Name;
		m_recordset.m_Item = m_Item;
		m_recordset.m_Start = m_Start;
		m_recordset.m_End = m_End;
		m_recordset.m_Startdate = m_Startdate;
		m_recordset.m_Enddate = m_Enddate;
		m_recordset.m_Charge = m_Charge;

		m_recordset.Update();

		m_recordset.Close();
//	CDialog::OnOK();
}

⌨️ 快捷键说明

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