📄 jobinfo.cpp
字号:
// JobInfo.cpp : implementation file
//
#include "stdafx.h"
#include "train.h"
#include "JobInfo.h"
#include "JobSet.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CJobInfo dialog
CJobInfo::CJobInfo(CWnd* pParent /*=NULL*/)
: CDialog(CJobInfo::IDD, pParent)
{
//{{AFX_DATA_INIT(CJobInfo)
m_name = _T("");
m_scope = _T("");
//}}AFX_DATA_INIT
}
void CJobInfo::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CJobInfo)
DDX_Text(pDX, IDC_EDIT1, m_name);
DDX_Text(pDX, IDC_EDIT2, m_scope);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CJobInfo, CDialog)
//{{AFX_MSG_MAP(CJobInfo)
ON_BN_CLICKED(IDC_BUTTONRESET, OnButtonreset)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CJobInfo message handlers
void CJobInfo::OnCancel()
{
// TODO: Add extra cleanup here
m_database.Close();
CDialog::OnCancel();
}
void CJobInfo::OnOK()
{
// TODO: Add extra validation here
UpdateData(TRUE);
CString strSQL;
// CResourceSet m_recordset(&m_database);
int i=1;
int flag=0;
while(!flag){
CJobSet m_recordset(&m_database);
strSQL.Format("select * from JOB where JOB_ID=%d",i);
m_recordset.Open(AFX_DB_USE_DEFAULT_TYPE,strSQL);
if(m_recordset.GetRecordCount()==0){
strSQL.Format("insert into JOB values(%d,\'%s\',\'%s\')",i,m_name,m_scope);
m_database.ExecuteSQL(strSQL);
m_database.Close();
CDialog::OnOK();
flag=1;
}
i++;
//m_recordset.Delete();
}
CDialog::OnOK();
}
void CJobInfo::OnButtonreset()
{
// TODO: Add your control notification handler code here
m_scope.Empty();
m_name.Empty();
UpdateData(FALSE);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -