4,017
社区成员
发帖
与我相关
我的任务
分享#if !defined( __CPDATABASE_H_ )
#define __CPDATABASE_H_
#pragma warning (disable : 4127) // conditional expression is constant
class CCPDatabase : public CDatabase
{
public:
/**/ CCPDatabase()
{
};
//
// Code Is Copied From CDatabase Source Code...
//
virtual BOOL OpenEx( LPCTSTR lpszConnectString, DWORD dwOptions = 0 )
{
dwOptions |= noOdbcDialog; // Force NoDialog Flag For Connection Pooling
ASSERT_VALID(this);
ASSERT(lpszConnectString == NULL || AfxIsValidString(lpszConnectString));
ASSERT(!(dwOptions & noOdbcDialog && dwOptions & forceOdbcDialog));
// Exclusive access not supported.
ASSERT(!(dwOptions & openExclusive));
m_bUpdatable = !(dwOptions & openReadOnly);
TRY
{
m_strConnect = lpszConnectString;
// Allocate the HDBC and make connection
AllocConnect(dwOptions);
if(!Connect(dwOptions))
return FALSE;
// Verify support for required functionality and cache info
VerifyConnect();
GetConnectInfo();
}
CATCH_ALL(e)
{
Free();
THROW_LAST();
}
END_CATCH_ALL
return TRUE;
}
};
#pragma warning (disable : 4127) // conditional expression is constant
#endif // __CPDATABASE_H_