• 大小: 144KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-06-02
  • 语言: C/C++
  • 标签: vc++  vs2008sp1  Access  

资源简介

资源中是在VS2008 SP1开发环境中实现的VC++对Access数据库进行查询、插入、更新、删除等操作的实例,会对你进行相关的开发有一定的基础性帮助。

资源截图

代码片段和文件信息


// Point32.cpp : 定义应用程序的类行为。
//

#include “stdafx.h“
#include “Point32.h“
#include “Point32Dlg.h“

#ifdef _DEBUG
#define new DEBUG_NEW
#endif


// CPoint32App

BEGIN_MESSAGE_MAP(CPoint32App CWinAppEx)
ON_COMMAND(ID_HELP &CWinApp::onhelp)
END_MESSAGE_MAP()


// CPoint32App 构造

CPoint32App::CPoint32App()
{
// TODO: 在此处添加构造代码,
// 将所有重要的初始化放置在 InitInstance 中
}


// 唯一的一个 CPoint32App 对象

CPoint32App theApp;


// CPoint32App 初始化

BOOL CPoint32App::InitInstance()
{
// 如果一个运行在 Windows XP 上的应用程序清单指定要
// 使用 ComCtl32.dll 版本 6 或更高版本来启用可视化方式,
//则需要 InitCommonControlsEx()。否则,将无法创建窗口。
INITCOMMONCONTROLSEX InitCtrls;
InitCtrls.dwSize = sizeof(InitCtrls);
// 将它设置为包括所有要在应用程序中使用的
// 公共控件类。
InitCtrls.dwICC = ICC_WIN95_CLASSES;
InitCommonControlsEx(&InitCtrls);

CWinAppEx::InitInstance();

AfxEnableControlContainer();

// 标准初始化
// 如果未使用这些功能并希望减小
// 最终可执行文件的大小,则应移除下列
// 不需要的特定初始化例程
// 更改用于存储设置的注册表项
// TODO: 应适当修改该字符串,
// 例如修改为公司或组织名
SetRegistryKey(_T(“应用程序向导生成的本地应用程序“));

// 获取应用程序(EXE)所在路径
char filepath[256];
char* pPath; 
GetModuleFileName(AfxGetInstanceHandle()filepath256);
pPath  = strrchr(filepath‘\\‘);
*pPath = 0;
path = filepath;
//创建access数据库访问连接
AfxOleInit();
CString connstr =  “Provider=Microsoft.Jet.OLEDB.4.0;Data Source=“;
connstr += path;
connstr += “\\point32.mdb“;
connstr += “;Jet OLEDB:Database Password=‘1234‘“;
/*PtConnectStr = new char[connstr.GetLength()+1];
ZeroMemory(PtConnectStr(connstr.GetLength()+1));
strcpy(PtConnectStr connstr.GetBuffer());*/
PtConnectStr = connstr.GetBuffer(0);

CPoint32Dlg dlg;
m_pMainWnd = &dlg;
INT_PTR nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
// TODO: 在此放置处理何时用
//  “确定”来关闭对话框的代码
}
else if (nResponse == IDCANCEL)
{
// TODO: 在此放置处理何时用
//  “取消”来关闭对话框的代码
}

// 由于对话框已关闭,所以将返回 FALSE 以便退出应用程序,
//  而不是启动应用程序的消息泵。
return FALSE;
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件     225280  2014-12-08 14:52  Point32\Debug\point32.mdb

     文件     105248  2013-12-17 15:34  Point32\Point32.aps

     文件       2270  2013-12-17 15:30  Point32\Point32.cpp

     文件        451  2013-12-16 13:29  Point32\Point32.h

     文件       5467  2013-12-17 15:34  Point32\Point32.rc

     文件        879  2013-12-16 13:29  Point32\Point32.sln

    ..A..H.     49664  2014-12-08 14:51  Point32\Point32.suo

     文件       5482  2013-12-16 13:37  Point32\Point32.vcproj

     文件       9004  2013-12-17 16:34  Point32\Point32Dlg.cpp

     文件        876  2013-12-17 15:20  Point32\Point32Dlg.h

     文件       2869  2013-12-16 13:29  Point32\ReadMe.txt

    .......     67777  2007-11-28 16:21  Point32\res\Point32.ico

     文件        363  2013-12-16 13:29  Point32\res\Point32.rc2

     文件        863  2013-12-17 14:15  Point32\resource.h

     文件        208  2013-12-17 13:49  Point32\stdafx.cpp

     文件       2059  2013-12-17 13:50  Point32\stdafx.h

     文件       1030  2013-12-16 13:29  Point32\targetver.h

     目录          0  2014-12-08 14:52  Point32\Debug

     目录          0  2013-12-16 13:29  Point32\res

     目录          0  2014-12-08 14:51  Point32

----------- ---------  ---------- -----  ----

               479790                    20


评论

共有 条评论