⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 database.cpp

📁 类似flashget下载工具代码 本来想在完善了上传的
💻 CPP
字号:
// DataBase.cpp: implementation of the CDataBase class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"

#include "DataBase.h"

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

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
CDataBase* CDataBase::m_pDataBase = NULL;
//////////////////////////////////////////////////////////////////////

CDataBase::CDataBase()
{
    
	CString m_sBinPath = _T("");
	TCHAR szFullPath[MAX_PATH];
	TCHAR szDir[MAX_PATH];
	TCHAR szDrive[MAX_PATH];
	GetModuleFileName(NULL,szFullPath,MAX_PATH); 
	_splitpath(szFullPath,szDrive,szDir,NULL,NULL);
	m_sBinPath.Format(_T("%s%s"),szDrive,szDir);

    //指定并确认配置文件	
	m_sIniFileName = m_sBinPath + _T("Config.ini");
	TCHAR pathbuf[_MAX_PATH];
	ZeroMemory(pathbuf, _MAX_PATH);	
	//DB数据原
	::GetPrivateProfileString("DBINFO","DBCon","",pathbuf,255,m_sIniFileName);
	m_Connstring = pathbuf;
    
   

}

CDataBase::~CDataBase()
{

}

CDataBase* CDataBase::Instance()
{
      if(m_pDataBase==NULL) 
		  m_pDataBase = new CDataBase();
	   
	  return m_pDataBase;
}



BEGIN_MESSAGE_MAP(CDataBase, CWnd)
	//{{AFX_MSG_MAP(CMainFrame)
		// NOTE - the ClassWizard will add and remove mapping macros here.
		//    DO NOT EDIT what you see in these blocks of generated code !
		//}}AFX_MSG_MAP
END_MESSAGE_MAP()




//********************************************************************************** 
//** 文件名称: DataBase.cpp
//** CopyRight (c) 2000-2008 
//** 文件描述: 
//** 创 建 人: 
//** 创建日期: 2007-5-23
//**************修改记录************************************************************ 
//** 修 改 者: 
//** 修改日期: 2007-5-23
//** 版    本: v1.0
//********************************************************************************** 
BOOL CDataBase::Opendb(CString& strcon)
{   
   if(!m_DBConn.IsOpen())
   {
	 if(!m_DBConn.Open(strcon))
        return FALSE; 
	else
        return TRUE;
   }
}

⌨️ 快捷键说明

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