📄 wglado.cpp
字号:
// WglAdo.cpp: implementation of the WglAdo class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "Wgl.h"
#include "WglAdo.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
WglAdo::WglAdo()
{
if(FAILED(m_pConnection.CreateInstance("ADODB.Connection")))
{
AfxMessageBox("Create Instance failed!");
return;
}
}
WglAdo::~WglAdo()
{
}
BOOL WglAdo::GetConnection(CString strFilename)
{
CString str40="Provider=Microsoft.Jet.OLEDB.4.0;";
CString strSource=str40+CString("Data Source=")+strFilename;
_bstr_t str (strSource);
try
{
m_pConnection->Open((LPCTSTR) str, "","",adModeUnknown);
}
catch(_com_error e)
{
AfxMessageBox("数据库连接失败,确认数据库是否在当前路径下!");
return FALSE;
}
return TRUE;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -