How to create mdb dynamic(vc6.0+ado)?
来源:互联网 发布:杰普软件 编辑:程序博客网 时间:2024/05/22 03:11
In csdn bbs, I found there was a lot of programmer to ask how to create mdb dynamic?
Now I give my resolvent!
here is the main code(vc6.0+ado):
#import "c:/Program Files/Common Files/system/ado/msadox.dll" rename_namespace("ADOX") #import "c:/Program Files/Common Files/System/ADO/msado15.dll" / rename_namespace("ADO") rename("EOF", "EndOfFile")#pragma warning (disable: 4146)#include "icrsint.h"#include "Shlwapi.h"#pragma comment(lib,"Shlwapi.lib")using namespace ADO;CoInitialize(NULL);using namespace ADOX;_CatalogPtr m_pCatalog = NULL;CString strConnection, strTable;TCHAR chFilePath[MAX_PATH];GetModuleFileName(NULL,chFilePath,MAX_PATH);(_tcsrchr(chFilePath, '//'))[1] = 0;lstrcat(chFilePath , _T("Test.mdb"));strTable = chFilePath;strConnection = _T("Provider=Microsoft.JET.OLEDB.4.0;Data source = ") + strTable + _T(";Jet OLEDB:Engine Type=5;");if(!PathFileExists(chFilePath)){ try { m_pCatalog.CreateInstance(__uuidof(Catalog)); m_pCatalog->Create(_bstr_t(strConnection )); } catch(...) { m_pCatalog->Release(); m_pCatalog = NULL; CoUninitialize(); } m_pCatalog->Release(); // m_pCatalog->Release(); // m_pCatalog = NULL;}CoUninitialize();
if there is some errors,please email to me : monkeycd@163.com :)
operating system:winxp+vc6.0+vsp6.0+access2000
- How to create mdb dynamic(vc6.0+ado)?
- How to Create Dynamic Settings Pages
- How to compile SonicUI using VC6.0?
- How to use gdi+ in vc6.0
- How to create singleton
- How to create alarm
- How to create WCF
- How to Create Tables
- Siebel HOW TO: How to create Products?
- How to Create a Customer
- How to create Firefox extensions
- How to create new geodatabases
- how to create cifs.ko
- How to create EPS files...
- How to create PFX file
- how to create a Makefile
- [AngularJS] How to create Directives?
- How to create recovery image
- SQL Server 中易混淆的数据类型
- sql server 中字段类型及说明
- 利用Graphics的MeasureString方法测量特定字符串的长度
- 给微软上课的车夫
- Microsoft Internet Explorer DBCS Remote Memory Corruption Vulnerability
- How to create mdb dynamic(vc6.0+ado)?
- Ultr@VNC <= 1.0.1 client Log::ReallyPrint Buffer Overflow Exploit
- ASP.net中判断全角半角的问题
- Delphi对XML的支持TXMLDocument类-1
- Delphi对XML的支持TXMLDocument类-2
- Delphi对XML的支持TXMLDocument类-3
- C程序设计的常用算法
- 一个俄罗斯人设计的j2me - float 算法
- VC6路径设置错误引发的无法调试的奇怪问题