📄 brr.cpp
字号:
// BRR.cpp: implementation of the CBRR class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "Office.h"
#include "BRR.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CBRR::CBRR()
{
}
CBRR::~CBRR()
{
}
CString CBRR::GetRecordType()
{
return recordType;
}
CString CBRR::GetBorrower()
{
return borrower;
}
CString CBRR::GetGoods()
{
return goods;
}
CString CBRR::GetRemark()
{
return remark;
}
COleDateTime CBRR::GetRecordDate()
{
return recordDate;
}
int CBRR::GetNum()
{
return num;
}
void CBRR::SetRecordType(CString vRecordType)
{
recordType=vRecordType;
}
void CBRR::SetBorrower(CString vBorrower)
{
borrower=vBorrower;
}
void CBRR::SetGoods(CString vGoods)
{
goods=vGoods;
}
void CBRR::SetRemark(CString vRemark)
{
remark=vRemark;
}
void CBRR::SetRecordDate(COleDateTime vRecordDate)
{
recordDate=vRecordDate;
}
void CBRR::SetNum(int vNum)
{
num=vNum;
}
void CBRR::sqlInsert()
{
CString strSQL;
strSQL="select * from BRRRecord";
_RecordsetPtr m_pRecordset;
HRESULT hTRes;
hTRes = m_pRecordset.CreateInstance(_T("ADODB.Recordset"));
hTRes = m_pRecordset->Open((LPTSTR)strSQL.GetBuffer(130),
((COfficeApp*)AfxGetApp())->m_pConn.GetInterfacePtr(),
adOpenDynamic,adLockPessimistic,adCmdText);
if(SUCCEEDED(hTRes))
{
m_pRecordset->AddNew();
CString str;
m_pRecordset->PutCollect("recordType",_variant_t(recordType));
m_pRecordset->PutCollect("recordDate",_variant_t(recordDate));
m_pRecordset->PutCollect("borrower",_variant_t(borrower));
m_pRecordset->PutCollect("goods",_variant_t(goods));
str.Format("%d",num);
m_pRecordset->PutCollect("num",_variant_t(str));
m_pRecordset->PutCollect("remark",_variant_t(remark));
m_pRecordset->Update();
}
}
void CBRR::sqlDelete(CString vGoods)
{
CString strSQL;
strSQL="delete from BRRRecord where goods='";
strSQL=strSQL+vGoods+"'";
(((COfficeApp*)AfxGetApp())->m_pConn)->Execute((_bstr_t)strSQL,NULL,adCmdText);
}
void CBRR::sqlUpdate(CString vGoods)
{
CString strSQL;
strSQL="select * from BRRRecord where goods='";
strSQL=strSQL+vGoods+"'";
_RecordsetPtr m_pRecordset;
HRESULT hTRes;
hTRes = m_pRecordset.CreateInstance(_T("ADODB.Recordset"));
hTRes = m_pRecordset->Open((LPTSTR)strSQL.GetBuffer(130),
((COfficeApp*)AfxGetApp())->m_pConn.GetInterfacePtr(),
adOpenDynamic,adLockPessimistic,adCmdText);
if(!(m_pRecordset->adoEOF))
{
CString str;
m_pRecordset->PutCollect("recordType",_variant_t(recordType));
m_pRecordset->PutCollect("recordDate",_variant_t(recordDate));
m_pRecordset->PutCollect("borrower",_variant_t(borrower));
m_pRecordset->PutCollect("goods",_variant_t(goods));
// m_pRecordset->PutCollect("num",_variant_t(num));
m_pRecordset->PutCollect("remark",_variant_t(remark));
m_pRecordset->Update();
}
}
void CBRR::GetData(CString vGoods)
{
CString strSQL;
strSQL="select * from BRRRecord where goods='";
strSQL=strSQL+vGoods+"'";
_RecordsetPtr m_pRecordset;
HRESULT hTRes;
hTRes = m_pRecordset.CreateInstance(_T("ADODB.Recordset"));
hTRes = m_pRecordset->Open((LPTSTR)strSQL.GetBuffer(130),
((COfficeApp*)AfxGetApp())->m_pConn.GetInterfacePtr(),
adOpenDynamic,adLockPessimistic,adCmdText);
if(SUCCEEDED(hTRes))
{
CString str;
borrower= ((COfficeApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("borrower"));
goods= ((COfficeApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("goods"));
recordDate= m_pRecordset->GetCollect("recordDate");
num= m_pRecordset->GetCollect("num").intVal;
recordType= ((COfficeApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("recordType"));
remark= ((COfficeApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("remark"));
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -