dbrecord.cpp

来自「自己编写的用户信息显示系统 包括了对数据库的简单操作 实现了连接」· C++ 代码 · 共 49 行

CPP
49
字号
// DBRecord.cpp: implementation of the CDBRecord class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "UserIn.h"
#include "DBRecord.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CDBRecord::CDBRecord()
{
	re.CreateInstance ("ADODB.Recordset");
	Actived=false;
}

CDBRecord::~CDBRecord()
{
	re.Release ();
}
bool CDBRecord::Open (CString str,CDBConnect * mcon)
{
	try
	{
		re->Open (_variant_t(str),mcon->con .GetInterfacePtr (),adOpenStatic,adLockOptimistic,adCmdText);
		Actived=true;
		return true;
	}
	catch(_com_error &e)
	{
		AfxMessageBox(e.ErrorMessage ());
		return false;
	}
}
void CDBRecord::Close ()
{
	if(Actived)
	{
		re->Close ();
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?