資源簡介
實現客戶端與服務器之間的通信,心跳包來檢測客戶端的狀態。對于傳輸的數據可以進行數據庫的存儲查詢操作

代碼片段和文件信息
//?AdoConnect.cpp:?implementation?of?the?CAdoConnect?class.
//
//////////////////////////////////////////////////////////////////////
#include?“stdafx.h“
#include?“Shop.h“
#include?“AdoConnect.h“
#ifdef?_DEBUG
#undef?THIS_FILE
static?char?THIS_FILE[]=__FILE__;
#define?new?DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
//?Construction/Destruction
//////////////////////////////////////////////////////////////////////
CAdoConnect::CAdoConnect()
{
}
CAdoConnect::~CAdoConnect()
{
}
BOOL?CAdoConnect::ExecuteSQL(_bstr_t?bstrSQL)
{
_variant_t?RecordsetAffected;
try
{
if(m_pConnection?==NULL)
{
OnInitADOConn();
}
m_pConnection->Execute(bstrSQLNULLadCmdText);
return?true;
}
catch(_com_error?&e)
{
AfxMessageBox(e.Description());
return?false;
}
}
void?CAdoConnect::ExitConnect()
{
if(m_pRecordset?!=?NULL)
{
m_pRecordset->Close();
m_pConnection->Close();
m_pRecordset?=NULL;
m_pConnection?=NULL;
::CoUninitialize();
}
}
_RecordsetPtr&?CAdoConnect::GetRecordSet(_bstr_t?bstrSQL)
{
try
{
if(m_pConnection?==?NULL)
{
OnInitADOConn();
}
m_pRecordset.CreateInstance(__uuidof(Recordset));
m_pRecordset->Open(bstrSQLm_pConnection.GetInterfacePtr()adOpenDynamicadLockOptimisticadCmdText);
}
catch(_com_error?&e)
{
AfxMessageBox(e.Description());
}
return?m_pRecordset;
}
void?CAdoConnect::OnInitADOConn()
{
::CoInitialize(NULL);
try
{
m_pConnection.CreateInstance(__uuidof(Connection));
?m_pConnection->Open(“Driver={MySQL?ODBC?5.1?Driver};Server=localhost;port=3306;Database=new;UID=root;PASSWORD=root;OPTION=3“““““adModeUnknown);
}
catch(_com_error?&e)
{
AfxMessageBox(e.Description());
}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????1839??2012-11-08?10:05??TCP通信\Shop\AdoConnect.cpp
?????文件????????718??2012-11-07?13:29??TCP通信\Shop\AdoConnect.h
?????文件??????64337??2012-11-08?15:09??TCP通信\Shop\Debug\AdoConnect.obj
?????文件??????????0??2012-11-08?11:09??TCP通信\Shop\Debug\AdoConnect.sbr
?????文件??????16104??2012-11-08?15:09??TCP通信\Shop\Debug\EnBitmap.obj
?????文件??????90657??2012-05-29?02:16??TCP通信\Shop\Debug\msado15.tlh
?????文件??????76633??2012-05-29?02:16??TCP通信\Shop\Debug\msado15.tli
?????文件??????27152??2012-11-08?15:09??TCP通信\Shop\Debug\MyBitmap.obj
?????文件????4350976??2012-11-08?11:36??TCP通信\Shop\Debug\Shop.bsc
?????文件?????217132??2012-11-08?15:09??TCP通信\Shop\Debug\Shop.exe
?????文件?????595912??2012-11-08?15:09??TCP通信\Shop\Debug\Shop.ilk
?????文件??????16660??2012-11-08?15:09??TCP通信\Shop\Debug\Shop.obj
?????文件????7843896??2012-11-08?15:09??TCP通信\Shop\Debug\Shop.pch
?????文件?????664576??2012-11-08?15:09??TCP通信\Shop\Debug\Shop.pdb
?????文件???????3872??2012-11-08?15:08??TCP通信\Shop\Debug\Shop.res
?????文件??????????0??2012-11-08?11:35??TCP通信\Shop\Debug\Shop.sbr
?????文件?????142794??2012-11-08?15:09??TCP通信\Shop\Debug\ShopDlg.obj
?????文件??????????0??2012-11-08?11:36??TCP通信\Shop\Debug\ShopDlg.sbr
?????文件??????42532??2012-11-08?15:09??TCP通信\Shop\Debug\SkinButton.obj
?????文件???????5386??2012-11-08?15:09??TCP通信\Shop\Debug\SkinResource.obj
?????文件??????94652??2012-11-08?15:09??TCP通信\Shop\Debug\SkinWin.obj
?????文件?????138382??2012-11-08?15:09??TCP通信\Shop\Debug\StdAfx.obj
?????文件????1798418??2012-11-08?11:09??TCP通信\Shop\Debug\StdAfx.sbr
?????文件??????22549??2012-11-08?15:09??TCP通信\Shop\Debug\Subclass.obj
?????文件??????18827??2012-11-08?15:09??TCP通信\Shop\Debug\Utils.obj
?????文件?????271360??2012-11-08?15:09??TCP通信\Shop\Debug\vc60.idb
?????文件?????577536??2012-11-08?15:09??TCP通信\Shop\Debug\vc60.pdb
?????文件???????3543??2012-11-06?14:07??TCP通信\Shop\ReadMe.txt
?????文件???????1078??2012-11-06?14:07??TCP通信\Shop\res\Shop.ico
?????文件????????396??2012-11-06?14:07??TCP通信\Shop\res\Shop.rc2
............此處省略188個文件信息
評論
共有 條評論