本文整理汇总了C++中_ConnectionPtr::Close方法的典型用法代码示例。如果您正苦于以下问题:C++ _ConnectionPtr::Close方法的具体用法?C++ _ConnectionPtr::Close怎么用?C++ _ConnectionPtr::Close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类_ConnectionPtr
的用法示例。
在下文中一共展示了_ConnectionPtr::Close方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ExitConnect
//断开连接
void ExitConnect(void)
{
if(m_pRecordset!=NULL){
m_pRecordset->Close();
m_pConnection->Close();
}
::CoUninitialize(); //释放环境
}
示例2: ExitConnect
void ADOConn::ExitConnect(void)
{
//关闭记录集和连接
if (m_pRecordset!=NULL)
{
m_pRecordset->Close();
}
m_pConnection->Close();
::CoUninitialize();
}
示例3: ADOCloseConnectDB
//断开指定数据库连接对象连接
int CCommDBOper::ADOCloseConnectDB(_ConnectionPtr &pCon,int iWarn)
{
if ((pCon != NULL) && (pCon->State == adStateOpen) )
{
try
{
pCon->Close();
}
catch (_com_error &e)
{
CString strMsg;
strMsg.Format("%s:%d %s", __FILE__, __LINE__, (LPSTR)e.Description());
AfxMessageBox(strMsg);
}
}
return RET_OK;
}
示例4: CloseDB
DWORD CNHSQLServerDBO::CloseDB(_ConnectionPtr &pConnection)
{
//assert(NULL != pConnection);
DWORD dwReturn(0x00);
try
{
//关闭连接
if (NULL!=pConnection && adStateClosed!=pConnection->State)
{
pConnection->Close();
}
if (NULL != pConnection)
{
pConnection.Release();
pConnection = NULL;
}
}
catch (_com_error &e)
{
//#ifdef _DEBUG
// 输出错误信息到输出窗口
OutputDebugStringW(L"\t");
OutputDebugStringW(L"CNHSQLServerDBO::CloseDB发生错误。");
OutputDebugStringW(L"\n");
// 输出错误信息到日志文件
if (0 != wcscmp(m_wchLogFilePath, L""))
{
// 当日志文件路径不为空时,写日志
CNHLogAPI::WriteLogEx(m_wchLogFilePath, LOG_ERR, L"NHSQLServerDBO", L"CNHSQLServerDBO::CloseDB发生错误。");
}
OutputDBErrMsg(e);
//#endif
dwReturn = 0x01;
}
// 卸载COM组件
CoUninitialize();
return dwReturn;
}
示例5: SaveSlideData
void CBacilusDetectDoc::SaveSlideData()
{
CString sql;
m_pRs->raw_Close();
sql.Format(_T("select *from BacilusDetect.dbo.PatientPerInfo where SlideID = '%s'"),m_SlideBoxData.SlideInfo.strSlideID);
m_pRs->Open((_variant_t)sql,m_pCon.GetInterfacePtr(),adOpenKeyset,adLockOptimistic,adCmdText);
if(m_pRs->adoEOF)//如果之前没有SlideID信息则
{
try
{
m_pRs->raw_Close();
//病人个人信息表
m_pRs->Open("SELECT * FROM BacilusDetect.dbo.PatientPerInfo",_variant_t((IDispatch*)m_pCon),adOpenStatic,adLockOptimistic,adCmdText);
m_pRs->AddNew();//添加一条新记录
m_pRs->Fields->GetItem(_variant_t("Name"))->Value=(_bstr_t)m_SlideBoxData.SlideInfo.strName;
m_pRs->Fields->GetItem(_variant_t("PatientID"))->Value=(_bstr_t)m_SlideBoxData.SlideInfo.strPatientID;
m_pRs->Fields->GetItem(_variant_t("Department"))->Value=(_bstr_t)m_SlideBoxData.SlideInfo.strDepartment;
m_pRs->Fields->GetItem(_variant_t("BedID"))->Value=(_bstr_t)m_SlideBoxData.SlideInfo.strBedID;
m_pRs->Fields->GetItem(_variant_t("Gender"))->Value=(_bstr_t)m_SlideBoxData.SlideInfo.nGender;
m_pRs->Fields->GetItem(_variant_t("Year"))->Value=(_bstr_t)m_SlideBoxData.SlideInfo.nYear;
m_pRs->Fields->GetItem(_variant_t("Occupation"))->Value=(_bstr_t)m_SlideBoxData.SlideInfo.strOccupation;
m_pRs->Fields->GetItem(_variant_t("Telephone"))->Value=(_bstr_t)m_SlideBoxData.SlideInfo.strTelephone;
m_pRs->Fields->GetItem(_variant_t("Address"))->Value=(_bstr_t)m_SlideBoxData.SlideInfo.strAddress;
m_pRs->Fields->GetItem(_variant_t("SlideID"))->Value=(_bstr_t)m_SlideBoxData.SlideInfo.strSlideID;
m_pRs->Update();
AfxMessageBox(_T("病人个人信息表保存成功!"));
}
catch(...)
{
AfxMessageBox(_T("病人个人信息表保存失败!"));
}
try
{
m_pRs->raw_Close();
//病人玻片信息表
m_pRs->Open("SELECT * FROM BacilusDetect.dbo.PatientSlideInfo",_variant_t((IDispatch*)m_pCon),adOpenStatic,adLockOptimistic,adCmdText);
m_pRs->AddNew();//添加一条新记录
m_pRs->Fields->GetItem(_variant_t("SlideID"))->Value=(_bstr_t)m_SlideBoxData.SlideInfo.strSlideID;
m_pRs->Fields->GetItem(_variant_t("Type"))->Value=(_bstr_t)m_SlideBoxData.SlideInfo.strType;
_variant_t var;
var.vt=VT_DATE;
var.date=int(m_SlideBoxData.SlideInfo.dtDetectData);
m_pRs->Fields->GetItem(_variant_t("DetectData"))->Value=(_bstr_t)var;
_variant_t vart;
vart.vt=VT_DATE;
vart.date=DATE(m_SlideBoxData.SlideInfo.dtDetectTime);
m_pRs->Fields->GetItem(_variant_t("DetectTime"))->Value=(_bstr_t)vart;
m_pRs->Fields->GetItem(_variant_t("Quantity"))->Value=(_bstr_t)m_SlideBoxData.SlideInfo.strQuantity;
m_pRs->Fields->GetItem(_variant_t("StayTime"))->Value=(_bstr_t)m_SlideBoxData.SlideInfo.strStayTime;
m_pRs->Fields->GetItem(_variant_t("Method"))->Value=(_bstr_t)m_SlideBoxData.SlideInfo.strMethod;
m_pRs->Fields->GetItem(_variant_t("SendDoctor"))->Value=(_bstr_t)m_SlideBoxData.SlideInfo.strSendDoctor;
m_pRs->Fields->GetItem(_variant_t("Judge"))->Value=(_bstr_t)m_SlideBoxData.SlideInfo.strJudge;
m_pRs->Fields->GetItem(_variant_t("DetectResult"))->Value=(_bstr_t)m_SlideBoxData.SlideInfo.strDetectResult;
m_pRs->Fields->GetItem(_variant_t("BacilusDensity"))->Value=(_bstr_t)m_SlideBoxData.SlideInfo.strBacilusDensity;
m_pRs->Fields->GetItem(_variant_t("FOVCount"))->Value=(_bstr_t)m_SlideBoxData.nFOVCount;
m_pRs->Fields->GetItem(_variant_t("bScan"))->Value=(_bstr_t)m_SlideBoxData.bScan;
m_pRs->Fields->GetItem(_variant_t("bJudge"))->Value=(_bstr_t)m_SlideBoxData.bJudge;
m_pRs->Fields->GetItem(_variant_t("TargetCount"))->Value=(_bstr_t)GetTargetCountInSlide();
m_pRs->Fields->GetItem(_variant_t("JudgedTargetCount"))->Value=(_bstr_t)GetJudgedTargetCountInSlide();
m_pRs->Update();
AfxMessageBox(_T("病人玻片信息表保存成功!"));
}
catch(...)
{
AfxMessageBox(_T("病人玻片信息表保存失败!"));
}
try
{
m_pRs->raw_Close();
//病人报告信息表
m_pRs->Open("SELECT * FROM BacilusDetect.dbo.PatientRepInfo",_variant_t((IDispatch*)m_pCon),adOpenStatic,adLockOptimistic,adCmdText);
m_pRs->AddNew();//添加一条新记录
m_pRs->Fields->GetItem(_variant_t("ReportDoctor"))->Value=(_bstr_t)m_SlideBoxData.SlideInfo.strReportDoctor;
_variant_t varr;
varr.vt=VT_DATE;
varr.date=int(m_SlideBoxData.SlideInfo.dtReportData);
m_pRs->Fields->GetItem(_variant_t("ReportData"))->Value=(_bstr_t)varr;
m_pRs->Fields->GetItem(_variant_t("CompareJudge"))->Value=(_bstr_t)m_SlideBoxData.SlideInfo.strCompareJudge;
m_pRs->Fields->GetItem(_variant_t("CompareDetectResult"))->Value=(_bstr_t)m_SlideBoxData.SlideInfo.strCompareDetectResult;
m_pRs->Fields->GetItem(_variant_t("CompareBacilusDensity"))->Value=(_bstr_t)m_SlideBoxData.SlideInfo.strCompareBacilusDensity;
m_pRs->Fields->GetItem(_variant_t("SlideID"))->Value=(_bstr_t)m_SlideBoxData.SlideInfo.strSlideID;
_variant_t var;
var.vt=VT_DATE;
var.date=int(m_SlideBoxData.SlideInfo.dtDetectData);
m_pRs->Fields->GetItem(_variant_t("DetectData"))->Value=(_bstr_t)var;
_variant_t vart;
vart.vt=VT_DATE;
vart.date=DATE(m_SlideBoxData.SlideInfo.dtDetectTime);
m_pRs->Fields->GetItem(_variant_t("DetectTime"))->Value=(_bstr_t)vart;
//.........这里部分代码省略.........