customer.cpp

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

CPP
66
字号
// Customer.cpp: implementation of the CCustomer class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "heavenmis.h"
#include "Customer.h"

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

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

CCustomer::CCustomer()
{
	m_Name="";
	m_ContactName="";
	m_Phone="";
	m_address="";
	m_Province="";
	m_City="";
}

CCustomer::~CCustomer()
{
}
void CCustomer::AddRecord()
{
	CADORecordset* pRs=new CADORecordset(((CHeavenMISApp*)AfxGetApp())->pDB);
	CString strSQL;
	strSQL.Format("select * from tbCustomer");
	pRs->Open(strSQL,CADORecordset::openQuery);
	pRs->AddNew();
	pRs->SetFieldValue("CompanyName",m_Name);
	pRs->SetFieldValue("ContactName",m_ContactName);
	pRs->SetFieldValue("ContactPhone",m_Phone);
	pRs->SetFieldValue("Address",m_address);
	pRs->SetFieldValue("Province",m_Province);
	pRs->SetFieldValue("City",m_City);
	pRs->Update();
	pRs->Close();
	delete pRs;
}
long CCustomer::GetKeyByName(CString name)
{
	CADORecordset* pRs=new CADORecordset(((CHeavenMISApp*)AfxGetApp())->pDB);
	CString strSQL;
	strSQL.Format("select CustomerID from tbCustomer where CompanyName='%s'",name);
	pRs->Open(strSQL,CADORecordset::openQuery);
	long key;
	if(pRs->GetRecordCount()==1)
	{
		pRs->GetFieldValue("CustomerID",key);
	}
	else key=-1;

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

}

⌨️ 快捷键说明

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