資源簡介
以vs2010編寫的MFC,用ADO方式連接sql2008,實現商品收費管理功能,包括掃碼收費、商品增刪查顯等功能
代碼片段和文件信息
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//?Command.cpp:?implementation?of?the?CConnection?class.???????????????????????????????????????????+??????????????????????????????????????????????
//?Author:?楊?小兵?@China??????????????????????????????????????????????????????????????????????????+
//?????????????????????????????????????????????????????????????????????????????????????????????????+
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#include?“stdafx.h“
#include?“Command.h“
using?namespace?ADOCONST;
////////////////////////////////////////////////////////////////////////////////////////////////////
//?Construction/Destruction???????????????????????????????????????????????????????????????????????//
////////////////////////////////////////////////////////////////////////////////////////////////////
CCommand::CCommand()
{
???CoInitialize(NULL);??
???m_pCmd.CreateInstance(“ADODB.Command“);
???//m_pCmd.CreateInstance(__uuidof(Command));
???//default?set
}
CCommand::~CCommand()
{
Release();
}
////////////////////////////////////////////////////////////////////////////////////////////////////
//?Property?Get/Set?Method????????????????????????????????????????????????????????????????????????//
////////////////////////////////////////////////////////////////////////////////////////////////////
//Property:?ActiveConnection
void?CCommand::SetActiveConnection(CConnection?&ActiveConn)
{
m_pCmd->PutActiveConnection(ActiveConn.GetConnection().GetInterfacePtr());
}
//Property:?CommandText
void?CCommand::SetCommandText(CString?strCmd)
{
????m_pCmd->PutCommandText(_bstr_t(strCmd));
}
//Property:?CommandTimeout
void?CCommand::SetCommandTimeout(long?time)
{
m_pCmd->PutCommandTimeout(time);
}
//Property:?State
objectStateEnum?CCommand::GetState()?const
{
return?(objectStateEnum)(m_pCmd->GetState());
}
////////////////////////////////////////////////////////////////////////////////////////////////////
//?Core?Method????????????????????????????????????????????????????????????????????????????????????//
////////////////////////////////////////////////////////////////////////////////////////////////////
//ExecuteQuery
bool?CCommand::ExecuteQuery(CRecordset?&RstCommandTypeEnum?CommandType)
{
????Rst.m_pRst=m_pCmd->Execute(NULLNULLCommandType);
return?true;
}
//ExecuteUpdate
bool?CCommand::ExecuteUpdate(long?&AffectedRowsCRecordset?&RstCommandTypeEnum?CommandType)
{
VARIANT?rows;?
????rows.vt?=?VT_I4;?
????Rst.m_pRst=m_pCmd->Execute(&rowsNULLCommandType);
AffectedRows=rows.lVal?;
return?true;
}
//Release
void?CCommand::Release()
{
if(m_pCmd!=NULL)
{
try
{
m_pCmd.Release();
m_pCmd=NULL;
}
catch(_com_error?e)
{
????????????throw?e;
}
}
}
//Cancel
bool?CCommand::Cancel()
{
if(m_pCmd==NULL)
{
//m_sErrorMes
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????4044??2011-05-14?21:03??零售店收費系統\ADO\ADOCONST.H
?????文件???????3537??2012-02-18?22:27??零售店收費系統\ADO\Command.cpp
?????文件???????2621??2012-02-18?21:58??零售店收費系統\ADO\Command.h
?????文件???????6643??2012-02-19?17:19??零售店收費系統\ADO\Connection.cpp
?????文件???????3374??2012-02-23?21:48??零售店收費系統\ADO\Connection.h
?????文件???????6409??2012-02-19?17:19??零售店收費系統\ADO\Recordset.cpp
?????文件???????5531??2012-02-19?16:22??零售店收費系統\ADO\Recordset.h
?????文件?????233984??2015-12-14?14:51??零售店收費系統\Debug\零售店收費系統.exe
?????文件????1313464??2015-12-14?14:51??零售店收費系統\Debug\零售店收費系統.ilk
?????文件????5704704??2015-12-14?14:51??零售店收費系統\Debug\零售店收費系統.pdb
?????文件?????132096??2015-12-13?21:42??零售店收費系統\Release\零售店收費系統.exe
?????文件????4918272??2015-12-13?21:42??零售店收費系統\Release\零售店收費系統.pdb
?????文件????????853??2015-12-12?22:38??零售店收費系統\零售店收費系統\ADD.cpp
?????文件????????445??2015-12-06?16:09??零售店收費系統\零售店收費系統\ADD.h
?????文件????????677??2015-12-11?21:10??零售店收費系統\零售店收費系統\Adosql.cpp
?????文件????????266??2015-12-06?00:03??零售店收費系統\零售店收費系統\Adosql.h
?????文件???????1404??2015-12-11?19:42??零售店收費系統\零售店收費系統\DBDlg.cpp
?????文件????????466??2015-12-05?15:04??零售店收費系統\零售店收費系統\DBDlg.h
?????文件??????29062??2015-12-14?14:49??零售店收費系統\零售店收費系統\Debug\ADD.obj
?????文件??????19499??2015-12-14?13:33??零售店收費系統\零售店收費系統\Debug\Adosql.obj
?????文件??????14266??2015-12-14?14:51??零售店收費系統\零售店收費系統\Debug\cl.command.1.tlog
?????文件?????151312??2015-12-14?14:51??零售店收費系統\零售店收費系統\Debug\CL.read.1.tlog
?????文件???????9796??2015-12-14?14:51??零售店收費系統\零售店收費系統\Debug\CL.write.1.tlog
?????文件??????29907??2015-12-14?14:49??零售店收費系統\零售店收費系統\Debug\DBDlg.obj
?????文件??????24472??2015-12-14?14:49??零售店收費系統\零售店收費系統\Debug\Del.obj
?????文件??????29236??2015-12-14?14:49??零售店收費系統\零售店收費系統\Debug\Find.obj
?????文件?????165078??2015-12-14?14:49??零售店收費系統\零售店收費系統\Debug\GuanliDlg.obj
?????文件??????????2??2015-12-14?14:51??零售店收費系統\零售店收費系統\Debug\li
?????文件??????????2??2015-12-14?14:51??零售店收費系統\零售店收費系統\Debug\li
?????文件??????????2??2015-12-14?14:51??零售店收費系統\零售店收費系統\Debug\li
............此處省略109個文件信息
評論
共有 條評論