VC++的ADO连接Access步骤
1:在StaAfx.h 中添加如下代码 #import "C:\\Program Files\\Common Files \\System\\ado\\msado15.dll" no_namespace rename("EOF","adoEOF")rename("BOF","adoBOF")
2:在BOOL CXXXApp::InitInstance()中初始化COM环境
::CoInitialize(NULL);
释放COM环境
::CoUninitialize();
3:在CXXXApp头文件中定义两个智能指针public
指向Recordset对象的指针
_RecordsetPtr m_pRecordset;
指向Connection对象的指针
_ConnectionPtr m_pConnection;
4:在void CXXXApp::OnInitADOConn()
{
//用于全局变量调用连接数据库
try
{
//创建连接对象实例
m_pConnection.CreateInstance("ADODB.Connection");
//设置连接字符串
CString strConnect="DRIVER={Microsoft Access Driver/ (*.mdb)};uid=;pwd=;DBQ=canyin.mdb;";
//使用open方法连接数据库
m_pConnection->Open((_bstr_t)strConnect,"","",adModeUnknown);
}
catch(_com_error e)
{
CString temp;
temp.Format("连接数据库错误信息:%s",e.ErrorMessage());
::MessageBox(NULL,temp,"提示信息",NULL);
}
}
5:void CXXXApp::ExitConnect()
{
//用于全局变量调用关闭数据库
//关闭记录集
if(m_pRecordset!=NULL)
m_pRecordset->Close();
m_pConnection->Close;
}
5:
<1> //打开数据库连接
OnInitADOConn();
1) //创建连接对象实例
m_pConnection.CreateInstance("ADODB.Connection");
&n
相关文档:
转帖:http://www.stealthcopter.com/blog/2010/01/android-requesting-root-access-in-your-app/
This snippet shows how root access can be requested inside an application in order to write a file into a place we do not have permission to access usually. Requesting root access will only work if your phon ......
<%Dim connstrconnstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("Stu.mdb")
Set bb = Server.CreateObject("ADODB.Connection")
bb.Open connstr%>
<html>
<head>
<meta http-equiv="content-Language" content="zh-cn" />
<meta http-equiv="Content-Type ......
熟悉SQL SERVER 2000的数据库管理员都知道,其DTS可以进行数据的导入导出,其实,我们也可以使用Transact-SQL语句进行导入导出操作。在 Transact-SQL语句中,我们主要使用OpenDataSource函数、OPENROWSET 函数,关于函数的详细说明,请参考SQL联机帮助。利用下述方法,可以十分容易地实现SQL SERV ......
CAPTION: 关于C/C++中内存空间的划分
AUTHOR: aIsland 摘自中国IT实验室
DATE: 2010-05-30
E-MAIL: aIsland@live.cn
QQ: 418662213
P.S.
1.Bolanlan|随心high|aIsland 三个网名均为本人
2.声明aIsland 所收录的所有文章其著作权都属于原创作者
  ......
/*
* File: main.cpp
* Author: Vicky
*
* Created on 2010年5月8日, 下午2:47
*/
#include <iostream>
using namespace std;
void swap(int x, int y) {
cout << "x and y swap before : " << x << "\t" << y << endl;
int i = x;
x = y;
y = i; ......