资源简介
基于VC6.0软件平台,使用MFC建立应用程序。通过ADO连接Access数据库将数据导入到MFC界面中的listview空间中。并且可以在界面中对数据库中的数据进行添加和删除操作。

代码片段和文件信息
// MSPRO.cpp : Defines the class behaviors for the application.
//
#include “stdafx.h“
#include “MSPRO.h“
#include “MSPRODlg.h“
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMSPROApp
BEGIN_MESSAGE_MAP(CMSPROApp CWinApp)
//{{AFX_MSG_MAP(CMSPROApp)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG
ON_COMMAND(ID_HELP CWinApp::onhelp)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMSPROApp construction
CMSPROApp::CMSPROApp()
{
// TODO: add construction code here
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CMSPROApp object
CMSPROApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CMSPROApp initialization
BOOL CMSPROApp::InitInstance()
{
AfxEnableControlContainer();
AfxOleInit();///初始化COM库
////////////连接数据库//////////////
HRESULT hr;
try
{
hr = m_pConnection.CreateInstance(“ADODB.Connection“);///创建Connection对象
if(SUCCEEDED(hr))
{
hr = m_pConnection->Open(“Provider=Microsoft.Jet.OLEDB.4.0;Data Source= AdoData.mdb“““““adModeUnknown);///连接数据库
//上面一句中连接字串中的Provider是针对ACCESS2000环境的,对于ACCESS97
//需要改为:Provider=Microsoft.Jet.OLEDB.3.51; }
}
}
catch(_com_error e)///捕捉异常
{
CString errormessage;
errormessage.Format(“连接数据库失败!\r\n错误信息:%s“e.ErrorMessage());
AfxMessageBox(errormessage);///显示错误信息
return FALSE;
}
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable you should remove from the following
// the specific initialization routines you do not need.
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
CMSPRODlg dlg;
m_pMainWnd = &dlg;
int nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
// TODO: Place code here to handle when the dialog is
// dismissed with OK
}
else if (nResponse == IDCANCEL)
{
// TODO: Place code here to handle when the dialog is
// dismissed with Cancel
}
// Since the dialog has been closed return FALSE so that we exit the
// application rather than start the application‘s message pump.
return FALSE;
}
int CMSPROApp::ExitInstance()
{
// TODO: Add your specialized code here and/or call the base class
if(m_pConnection->State)
m_pConnection->Close(); ///如果已经打开了连接则关闭它
return CWinApp::ExitInstance();
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 425984 2011-07-23 21:10 MSPRO\Adodata.mdb
文件 90733 2010-11-09 22:51 MSPRO\Debug\msado15.tlh
文件 76671 2010-11-09 22:51 MSPRO\Debug\msado15.tli
文件 4252672 2011-07-23 21:06 MSPRO\Debug\MSPRO.bsc
文件 131155 2011-07-23 21:06 MSPRO\Debug\MSPRO.exe
文件 395240 2011-07-23 21:06 MSPRO\Debug\MSPRO.ilk
文件 47130 2011-07-23 14:21 MSPRO\Debug\MSPRO.obj
文件 9538816 2011-07-22 20:24 MSPRO\Debug\MSPRO.pch
文件 615424 2011-07-23 21:06 MSPRO\Debug\MSPRO.pdb
文件 2992 2011-07-22 20:09 MSPRO\Debug\MSPRO.res
文件 0 2011-07-23 14:21 MSPRO\Debug\MSPRO.sbr
文件 87042 2011-07-23 21:06 MSPRO\Debug\MSPRODlg.obj
文件 0 2011-07-23 21:06 MSPRO\Debug\MSPRODlg.sbr
文件 133544 2011-07-22 20:24 MSPRO\Debug\StdAfx.obj
文件 1767056 2011-07-22 20:24 MSPRO\Debug\StdAfx.sbr
文件 246784 2011-07-23 21:09 MSPRO\Debug\vc60.idb
文件 561152 2011-07-23 21:06 MSPRO\Debug\vc60.pdb
文件 90664 2010-11-09 22:51 MSPRO\msado15.tlh
文件 76614 2010-11-09 22:51 MSPRO\msado15.tli
文件 36252 2011-07-22 20:09 MSPRO\MSPRO.APS
文件 1613 2011-07-23 21:33 MSPRO\MSPRO.clw
文件 2940 2011-07-23 14:21 MSPRO\MSPRO.cpp
文件 4215 2011-07-22 21:41 MSPRO\MSPRO.dsp
文件 535 2011-07-22 19:51 MSPRO\MSPRO.dsw
文件 1427 2011-07-23 09:58 MSPRO\MSPRO.h
文件 140288 2011-07-23 21:33 MSPRO\MSPRO.ncb
文件 55808 2011-07-23 21:33 MSPRO\MSPRO.opt
文件 709 2011-07-23 21:06 MSPRO\MSPRO.plg
文件 6084 2011-07-22 20:09 MSPRO\MSPRO.rc
文件 8657 2011-07-23 21:06 MSPRO\MSPRODlg.cpp
............此处省略13个文件信息
相关资源
- 基于MFC的TCP调试助手源码95706
- 基于mfc的多线程文件传输
- MFC数字钟(基于VC6.0)
- VC++MFC小游戏实例教程(实例)+MFC类库
- ChartCtrl控件库(可在VS2019中使用)
- Adobe Acrobat X Pro汉化CIDFont字体包
- 商品库存管理系统 C++ MFC
- 基础qt数据库读取和显示
- Qt查询SQLite数据库
- mfc 调用redis
- MFC视频播放器源码(支持avi/wma/mp3等格
- mfc绘图大全(画直线、矩形、椭圆)
- MFC控件重绘
- 宠物管理系统课程设计(源码+数据库
- hook,捕获所有案件,查找所有窗口,
- (学习)VS2010之MFC入门到精通教程
- MFC文档_视图_框架_模板结构体系深入
- 简单员工管理系统(适合初学MFC)
- VC操作SQLSERVER数据库
- c 操作sqlite数据库.cpp
- 简单职工管理系统(控制台源码+txt数
- MFC五子棋游戏
- MFC UDP编程
- MFC的异步网络通讯应用程序
- C++MFC模块讲解,黑发程序员课程整理
- 一个简单而强大的基于MFC的web server源
- 基于MFC的VC++仿QQ浏览器源码(雏形)
- MFCaccess.rar
- VC++MFC课程设计的学生成绩管理系统
- MFC 日历控件 万年历 Calendar自绘
评论
共有 条评论