📄 marketinformation.cpp
字号:
// MarketInformation.cpp: implementation of the CMarketInformation class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "ClientRelationship.h"
#include "MarketInformation.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CMarketInformation::CMarketInformation()
{
}
CMarketInformation::~CMarketInformation()
{
}
CString CMarketInformation::GetMarketInformationID()
{
return marketInformationID;
}
COleDateTime CMarketInformation::GetCollectDate()
{
return collectDate;
}
CString CMarketInformation::GetInformationLevel()
{
return informationLevel;
}
CString CMarketInformation::GetCollecter()
{
return collecter;
}
CString CMarketInformation::GetCollectDepartment()
{
return collectDepartment;
}
CString CMarketInformation::GetSubject()
{
return subject;
}
CString CMarketInformation::GetContent()
{
return content;
}
void CMarketInformation::SetMarketInformationID(CString vMarketInformationID)
{
marketInformationID=vMarketInformationID;
}
void CMarketInformation::SetCollectDate(COleDateTime vCollectDate)
{
collectDate=vCollectDate;
}
void CMarketInformation::SetInformationLevel(CString vInformationLevel)
{
informationLevel=vInformationLevel;
}
void CMarketInformation::SetCollecter(CString vCollecter)
{
collecter=vCollecter;
}
void CMarketInformation::SetCollectDepartment(CString vCollectDepartment)
{
collectDepartment=vCollectDepartment;
}
void CMarketInformation::SetSubject(CString vSubject)
{
subject=vSubject;
}
void CMarketInformation::SetContent(CString vContent)
{
content=vContent;
}
void CMarketInformation::sqlInsert()
{
CString strSQL;
strSQL="select * from marketInformation";
_RecordsetPtr m_pRecordset;
HRESULT hTRes;
hTRes = m_pRecordset.CreateInstance(_T("ADODB.Recordset"));
hTRes = m_pRecordset->Open((LPTSTR)strSQL.GetBuffer(130),
((CClientRelationshipApp*)AfxGetApp())->m_pConn.GetInterfacePtr(),
adOpenDynamic,adLockPessimistic,adCmdText);
if(SUCCEEDED(hTRes))
{
m_pRecordset->AddNew();
m_pRecordset->PutCollect("marketInformationID",_variant_t(marketInformationID));
m_pRecordset->PutCollect("collectDate",_variant_t(collectDate));
m_pRecordset->PutCollect("informationLevel",_variant_t(informationLevel.Left(50)));
m_pRecordset->PutCollect("subject",_variant_t(subject.Left(50)));
m_pRecordset->PutCollect("collecter",_variant_t(collecter.Left(50)));
m_pRecordset->PutCollect("collectDepartment",_variant_t(collectDepartment.Left(50)));
m_pRecordset->PutCollect("content",_variant_t(content.Left(50)));
m_pRecordset->Update();
}
}
void CMarketInformation::sqlUpdate(CString cMarketInformationID)
{
CString strSQL;
strSQL="select * from marketInformation where marketInformationID='";
strSQL+=cMarketInformationID+"'";
// AfxMessageBox(strSQL);
_RecordsetPtr m_pRecordset;
HRESULT hTRes;
hTRes = m_pRecordset.CreateInstance(_T("ADODB.Recordset"));
hTRes = m_pRecordset->Open((LPTSTR)strSQL.GetBuffer(130),
((CClientRelationshipApp*)AfxGetApp())->m_pConn.GetInterfacePtr(),
adOpenDynamic,adLockPessimistic,adCmdText);
if(!(m_pRecordset->adoEOF))
{
m_pRecordset->PutCollect("collectDate",_variant_t(collectDate));
m_pRecordset->PutCollect("informationLevel",_variant_t(informationLevel.Left(50)));
m_pRecordset->PutCollect("subject",_variant_t(subject.Left(50)));
m_pRecordset->PutCollect("collecter",_variant_t(collecter.Left(50)));
m_pRecordset->PutCollect("collectDepartment",_variant_t(collectDepartment.Left(50)));
m_pRecordset->PutCollect("content",_variant_t(content.Left(50)));
m_pRecordset->Update();
}
}
void CMarketInformation::sqlDelete(CString cMarketInformationID)
{
CString strSQL;
strSQL="delete from marketInformation where marketInformationID='";
strSQL=strSQL+cMarketInformationID+"'";
(((CClientRelationshipApp*)AfxGetApp())->m_pConn)->Execute((_bstr_t)strSQL,NULL,adCmdText);
}
void CMarketInformation::GetData(CString cMarketInformationID)
{
CString strSQL;
strSQL="select * from marketInformation where marketInformationID='";
strSQL+=cMarketInformationID+"'";
_RecordsetPtr m_pRecordset;
HRESULT hTRes;
hTRes = m_pRecordset.CreateInstance(_T("ADODB.Recordset"));
hTRes = m_pRecordset->Open((LPTSTR)strSQL.GetBuffer(130),
((CClientRelationshipApp*)AfxGetApp())->m_pConn.GetInterfacePtr(),
adOpenDynamic,adLockPessimistic,adCmdText);
if(SUCCEEDED(hTRes))
{
collectDate= m_pRecordset->GetCollect("collectDate");
informationLevel= ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("informationLevel"));
subject= ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("subject"));
collecter= ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("collecter"));
collectDepartment= ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("collectDepartment"));
content= ((CClientRelationshipApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("content"));
m_pRecordset->Update();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -