91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 5KB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發(fā)布日期: 2021-06-03
  • 語言: 其他
  • 標(biāo)簽: ado.h??ado.cpp??

資源簡(jiǎn)介

ado.h ado.cpp 鏈接數(shù)據(jù)庫的兩個(gè)文件

資源截圖

代碼片段和文件信息

//?ado.cpp?:?implementation?file
//
#include?“stdafx.h“
#include?“ado.h“
#include?
/////////////////////////////////////////////////////////////////////////////
//?CADODatabase?class

BOOL?CADODatabase::Open(LPCTSTR?lpstrConnection)
{
HRESULT?hr?=?S_OK;

if(IsOpen())
Close();

if(strcmp(lpstrConnection?_T(““))?!=?0)
m_strConnection?=?lpstrConnection;

ASSERT(!m_strConnection.IsEmpty());

try
{
hr?=?m_pConnection->Open(_bstr_t(m_strConnection)?““?““?NULL);
return?hr?==?S_OK;
}
catch(_com_error?&e)
{
dump_com_error(e);
}
return?FALSE;
}

BOOL?CADODatabase::Execute(LPCTSTR?lpstrExec)
{
ASSERT(m_pConnection?!=?NULL);
ASSERT(strcmp(lpstrExec?_T(““))?!=?0);

try
{
m_pConnection->Execute(_bstr_t(lpstrExec)?NULL?adExecuteNoRecords);
}
catch(_com_error?&e)
{
dump_com_error(e);
}
return?TRUE;
}

void?CADODatabase::dump_com_error(_com_error?&e)
{
CString?ErrorStr;


_bstr_t?bstrSource(e.Source());
_bstr_t?bstrDescription(e.Description());
ErrorStr.Format(?“CADODatabase?Error\n\tCode?=?%08lx\n\tCode?meaning?=?%s\n\tSource?=?%s\n\tDescription?=?%s\n“
e.Error()?e.ErrorMessage()?(LPCSTR)bstrSource?(LPCSTR)bstrDescription?);
m_strLastError?=?_T(“Connection?String?=?“?+?GetConnectionString()?+?‘\n‘?+?ErrorStr);
#ifdef?_DEBUG
AfxMessageBox(?ErrorStr?MB_OK?|?MB_IConerror?);
#endif
}

BOOL?CADODatabase::IsOpen()
{ try
{
return?(m_pConnection?!=?NULL?&&?(m_pConnection->State?&?adStateOpen));
}
catch?(_com_error?e)
{
dump_com_error(e);
return?FALSE;
}?
return?FALSE;
}

void?CADODatabase::Close()
{
try
{ if?(IsOpen())?
m_pConnection->Close();
}
catch?(_com_error?e)
{
dump_com_error(e);
}?
}

long?CADODatabase::BeginTransaction()
{
ASSERT(m_pConnection?!=?NULL);
try
{
return?m_pConnection->BeginTrans();
}
catch?(_com_error?e)
{
dump_com_error(e);
return?-1;
}?
return?-1;
}

BOOL?CADODatabase::CommitTransaction()
{
ASSERT(m_pConnection?!=?NULL);
try
{
return?SUCCEEDED(m_pConnection->CommitTrans());
}
catch?(_com_error?e)
{
dump_com_error(e);
return?FALSE;
}?
return?FALSE;
}

BOOL?CADODatabase::RollbackTransaction()
{
ASSERT(m_pConnection?!=?NULL);
try
{
return?SUCCEEDED(m_pConnection->RollbackTrans());
}
catch?(_com_error?e)
{
dump_com_error(e);
return?FALSE;
}?
return?FALSE;
}
/////////////////////////////////////////////////////////////////////////////
//?CADORecordset?class

/////////////////////////////////////////////////////////////////////////////
//構(gòu)造函數(shù)
CADORecordset::CADORecordset(CADODatabase*?pAdoDatabase)
{
m_pRecordset?=?NULL;
m_strQuery?=?_T(““);
m_pRecordset.CreateInstance(__uuidof(Recordset));
m_nSearchDirection?=?CADORecordset::searchForward;

m_pConnection?=?pAdoDatabase->GetActiveConnection();
}
////////////////////////////////////////////////////////////////////////

?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----

?????文件??????19238??2005-08-04?15:05??ado.cpp

?????文件???????6079??2005-08-04?16:19??ado.h

-----------?---------??----------?-----??----

????????????????25317????????????????????2


評(píng)論

共有 條評(píng)論

相關(guān)資源