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://topic.csdn.net/u/20100524/14/0eff992a-2849-4db6-bdaa-d4a200e79b7c.html
Çë·Ö±ðÓÃC++µÄÃæÏò¶ÔÏóºÍ·ºÐÍ»úÖÆ£¬±àдʵÏÖTemplate MethodģʽµÄʾÀý´úÂ룬²¢±È½ÏÁ½ÖÖ·½Ê½¸÷×ÔµÄÓÅȱµã¡£
ÓÃÐ麯ÊýʵÏÖTemplate MethodµÄ·½Ê½¾Í²»¶à˵ÁË¡£Ó÷ºÐ͵ķ½Ê½ÊµÏÖ¶à̬ÔÚATLÀïÃæÓдóÁ¿µÄÓõ½£¡
·ºÐ͵ ......
ÊìϤSQL SERVER 2000µÄÊý¾Ý¿â¹ÜÀíÔ±¶¼ÖªµÀ£¬ÆäDTS¿ÉÒÔ½øÐÐÊý¾ÝµÄµ¼Èëµ¼³ö£¬Æäʵ£¬ÎÒÃÇÒ²¿ÉÒÔʹÓÃTransact-SQLÓï¾ä½øÐе¼Èëµ¼³ö²Ù×÷¡£ÔÚ Transact-SQLÓï¾äÖУ¬ÎÒÃÇÖ÷ҪʹÓÃOpenDataSourceº¯Êý¡¢OPENROWSET º¯Êý£¬¹ØÓÚº¯ÊýµÄÏêϸ˵Ã÷£¬Çë²Î¿¼SQLÁª»ú°ïÖú¡£ÀûÓÃÏÂÊö·½·¨£¬¿ÉÒÔÊ®·ÖÈÝÒ×µØʵÏÖSQL SERV ......
/*
* 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; ......
Technorati ±êÇ©: C++ ÔÎĵØÖ·£ºhttp://www.byvoid.com/blog/c-int64/ ÔÚC/C++ÖУ¬64ΪÕûÐÍÒ»Ö±ÊÇÒ»ÖÖûÓÐÈ·¶¨¹æ·¶µÄÊý¾ÝÀàÐÍ¡£ÏÖ½ñÖ÷Á÷µÄ±àÒëÆ÷ÖУ¬¶Ô64ΪÕûÐ͵ÄÖ§³ÖÒ²ÊDZê×¼²»Ò»£¬ÐÎ̬¸÷Òì¡£Ò»°ãÀ´Ëµ£¬64λÕûÐ͵Ķ¨Ò巽ʽÓÐlong longºÍ__int64Á½ÖÖ(VC»¹Ö§³Ö_int64)£¬¶øÊä³öµ½±ê×¼Êä³ö·½Ê½ÓÐprintf(¡°%lld¡±,a)£¬printf ......