本文整理汇总了C++中_RecordsetPtr::Close方法的典型用法代码示例。如果您正苦于以下问题:C++ _RecordsetPtr::Close方法的具体用法?C++ _RecordsetPtr::Close怎么用?C++ _RecordsetPtr::Close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类_RecordsetPtr
的用法示例。
在下文中一共展示了_RecordsetPtr::Close方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnShowGrid
void CDlg::OnShowGrid(CString strSql,_RecordsetPtr& rs,_CommandPtr& Cmd,CDatagrid1& Grd,void (*pFGrd)(CDatagrid1&,_RecordsetPtr&))
{
if(!strSql.IsEmpty()) {
Cmd->CommandText = (_bstr_t)strSql;
try {
Grd.putref_DataSource(NULL);
if(rs->State==adStateOpen) rs->Close();
rs->Open(m_vNULL,m_vNULL,adOpenDynamic,adLockOptimistic,adCmdText);
m_Flg = false;
// m_Flg = true;
//AfxMessageBox(L"Before OnShow Grd.putref_DataSource((LPUNKNOWN)rs)");
Grd.putref_DataSource((LPUNKNOWN)rs);
//AfxMessageBox(L"After OnShow Grd.putref_DataSource((LPUNKNOWN)rs)");
// m_Flg = false;
/*----*/// m_Flg = true;
m_CurCol = Grd.get_Col();
// s.Format("%i",m_CurCol);
// AfxMessageBox(s);
if(m_CurCol==-1 || m_CurCol==0 ) {
m_CurCol = 1;
}
m_iCurType = GetTypeCol(rs,m_CurCol);
pFGrd(Grd,rs);
}
catch(_com_error& e) {
Grd.putref_DataSource(NULL);
AfxMessageBox(e.ErrorMessage());
}
}
}
示例2: ExitConnect
//断开连接
void ExitConnect(void)
{
if(m_pRecordset!=NULL){
m_pRecordset->Close();
m_pConnection->Close();
}
::CoUninitialize(); //释放环境
}
示例3: ExitConnect
void ADOConn::ExitConnect(void)
{
//关闭记录集和连接
if (m_pRecordset!=NULL)
{
m_pRecordset->Close();
}
m_pConnection->Close();
::CoUninitialize();
}
示例4: ADOCloseRecordset
//关闭指定记录集对象
int CCommDBOper::ADOCloseRecordset(_RecordsetPtr pRs,int iWarn)
{
if ((pRs != NULL) && (pRs->State == adStateOpen))
{
try
{
pRs->Close();
}
catch (_com_error &e)
{
CString strMsg;
strMsg.Format("%s:%d %s", __FILE__, __LINE__, (LPSTR)e.Description());
AfxMessageBox(strMsg);
}
}
return RET_OK;
}
示例5: CloseQuery
DWORD CNHSQLServerDBO::CloseQuery(_RecordsetPtr &pRecordset)
{
//assert(NULL != pRecordset);
DWORD dwReturn(0x00);
try
{
if (NULL!=pRecordset && adStateClosed!=pRecordset->State)
{
pRecordset->Close();
}
if (NULL != pRecordset)
{
pRecordset.Release();
pRecordset = NULL;
}
}
catch (_com_error &e)
{
//#ifdef _DEBUG
// 输出错误信息到输出窗口
OutputDebugStringW(L"\t");
OutputDebugStringW(L"CNHSQLServerDBO::CloseQuery发生错误。");
OutputDebugStringW(L"\n");
// 输出错误信息到日志文件
if (0 != wcscmp(m_wchLogFilePath, L""))
{
// 当日志文件路径不为空时,写日志
CNHLogAPI::WriteLogEx(m_wchLogFilePath, LOG_ERR, L"NHSQLServerDBO", L"CNHSQLServerDBO::CloseQuery发生错误。");
}
OutputDBErrMsg(e);
//#endif
dwReturn = 0x01;
}
return dwReturn;
}
示例6: 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;
//.........这里部分代码省略.........