- 1、本文档共29页,可阅读全部内容。
- 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
管理信息系统软件开发
第一步:
把数据库拷贝到当前工程目录下。
数据库的操纵包括增加、删除、修改等。为了实现同一接口操作,我们用函数ADOExecute统一所有的操作。
引入ADO动态链接库。
在StdAfx.h中加入:
#endif // _AFX_NO_AFXCMN_SUPPORT
// 加入ADO支持库
#import c:\program files\common files\system\ado\msado15.dll \
no_namespace \
rename (EOF, adoEOF) \
rename (LockTypEnum,newLockTypeEnum) \
rename (DataTypEnum,newDataTypeEnum) \
rename (FieldAttributeTypEnum,newFieldAttributeTypeEnum) \
rename (EditModeTypEnum,newEditModeTypeEnum) \
rename (RecordStatusTypEnum,newRecordStatusTypeEnum) \
rename (ParameterDirectionTypEnum,newParameterDirectionTypeEnum)
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__40A65179_036E_42A5_A8A9_4A__INCLUDED_)
若读者机器配置不同,可相应更改。
定义智能指针对象。
在类C工程名App的头文件中定义:
class CProviderApp : public CWinApp
{
public:
CProviderApp();
public:
_RecordsetPtr m_pRs;
private:
_ConnectionPtr m_pCon;
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CProviderApp)
public:
virtual BOOL InitInstance();
//}}AFX_VIRTUAL
// Implementation
//{{AFX_MSG(CProviderApp)
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
初始化智能指针。
在C工程名App的IniInstance方法中初始化:
BOOL CProviderApp::InitInstance()
{
AfxEnableControlContainer();
//Create ADO Database connection
if(FAILED(::CoInitialize(NULL)))
{
AfxMessageBox(ADO Init failed);
return false;
}
try
{
m_pCon.CreateInstance(_uuidof(Connection));
m_pCon-Open(Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Provider.mdb,
,,adConnectUnspecified);
AfxMessageBox(Init success !);
}
catch(_com_error e)
{
CString err;
err.Format(%s,(char *)(e.Description()));
AfxMessageBox(err);
}
catch(...)
{
AfxMessageBox(Unknown Error...);
}
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your
文档评论(0)