employee.cpp

来自「玩具百货公司销售进货记录系统!界面比较齐全,功能完善」· C++ 代码 · 共 44 行

CPP
44
字号
// Employee.cpp: implementation of the CEmployee class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "heavenmis.h"
#include "Employee.h"

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

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CEmployee::CEmployee()
{
	m_iEmpID=-1;
	m_Name="";
}

CEmployee::~CEmployee()
{
}
int CEmployee::GetKeyByName(CString name)
{
	CADORecordset* pRs=new CADORecordset(((CHeavenMISApp*)AfxGetApp())->pDB);
	CString strSQL;
	strSQL.Format("select EmployeeID from tbEmployee where Name='%s'",name);
	pRs->Open(strSQL,CADORecordset::openQuery);
	int key;
	if(pRs->GetRecordCount()==1)
	{
		pRs->GetFieldValue("EmployeeID",key);
	}
	else key=-1;

	pRs->Close();
	delete pRs;
	return key;
}

⌨️ 快捷键说明

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