Visual c++ 6.0 ADO access
ADO¿â°üº¬Èý¸ö»ù±¾½Ó¿Ú:_ConnectionPtr½Ó¿Ú¡¢_CommandPtr½Ó¿ÚºÍ_RecordsetPtr½Ó¿Ú¡£
_ConnectionPtr½Ó¿Ú·µ»ØÒ»¸ö¼Ç¼¼¯»òÒ»¸ö¿ÕÖ¸Õë¡£
ͨ³£Ê¹ÓÃËüÀ´´´½¨Ò»¸öÊý¾ÝÁ¬½Ó»òÖ´ÐÐÒ»Ìõ²»·µ»ØÈκνá¹ûµÄSQLÓï¾ä£¬ÈçÒ»¸ö´æ´¢¹ý³Ì¡£
ʹÓÃ_ConnectionPtr½Ó¿Ú·µ»ØÒ»¸ö¼Ç¼¼¯²»ÊÇÒ»¸öºÃµÄʹÓ÷½·¨¡£
ͨ³£Í¬CdatabaseÒ»Ñù£¬Ê¹ÓÃËü´´½¨Ò»¸öÊý¾ÝÁ¬½Ó£¬È»ºóʹÓÃÆäËü¶ÔÏóÖ´ÐÐÊý¾ÝÊäÈëÊä³ö²Ù×÷¡£
_CommandPtr½Ó¿Ú·µ»ØÒ»¸ö¼Ç¼¼¯¡£
ËüÌṩÁËÒ»ÖÖ¼òµ¥µÄ·½·¨À´Ö´Ðзµ»Ø¼Ç¼¼¯µÄ´æ´¢¹ý³ÌºÍSQLÓï¾ä¡£
ÔÚʹÓÃ_CommandPtr½Ó¿Úʱ£¬Äã¿ÉÒÔÀûÓÃÈ«¾Ö_ConnectionPtr½Ó¿Ú£¬Ò²¿ÉÒÔÔÚ_CommandPtr½Ó¿ÚÀïÖ±½ÓʹÓÃÁ¬½Ó´®¡£
Èç¹ûÄãÖ»Ö´ÐÐÒ»´Î»ò¼¸´ÎÊý¾Ý·ÃÎʲÙ×÷£¬ºóÕßÊDZȽϺõÄÑ¡Ôñ¡£
µ«Èç¹ûÄãҪƵ·±·ÃÎÊÊý¾Ý¿â£¬²¢Òª·µ»ØºÜ¶à¼Ç¼¼¯£¬ÄÇô£¬ÄãÓ¦¸ÃʹÓÃÈ«¾Ö_ConnectionPtr½Ó¿Ú´´½¨Ò»¸öÊý¾ÝÁ¬½Ó£¬
È»ºóʹÓÃ_CommandPtr½Ó¿ÚÖ´Ðд洢¹ý³ÌºÍSQLÓï¾ä¡£
_RecordsetPtrÊÇÒ»¸ö¼Ç¼¼¯¶ÔÏó¡£
ÓëÒÔÉÏÁ½ÖÖ¶ÔÏóÏà±È£¬Ëü¶Ô¼Ç¼¼¯ÌṩÁ˸ü¶àµÄ¿ØÖƹ¦ÄÜ£¬Èç¼Ç¼Ëø¶¨£¬Óαê¿ØÖƵÈ
¡£Í¬_CommandPtr½Ó¿ÚÒ»Ñù£¬Ëü²»Ò»¶¨ÒªÊ¹ÓÃÒ»¸öÒѾ´´½¨µÄÊý¾ÝÁ¬½Ó£¬
¿ÉÒÔÓÃÒ»¸öÁ¬½Ó´®´úÌæÁ¬½ÓÖ¸Õ븳¸ø_RecordsetPtrµÄconnection³ÉÔ±±äÁ¿£¬ÈÃËü×Ô¼º´´½¨Êý¾ÝÁ¬½Ó¡£
Èç¹ûÄãҪʹÓöà¸ö¼Ç¼¼¯£¬×îºÃµÄ·½·¨ÊÇͬCommand¶ÔÏóÒ»ÑùʹÓÃÒѾ´´½¨ÁËÊý¾ÝÁ¬½ÓµÄÈ«¾Ö_ConnectionPtr½Ó¿Ú
£¬È»ºóʹÓÃ_RecordsetPtrÖ´Ðд洢¹ý³ÌºÍSQLÓï¾ä¡£
(1)³õʼ»¯COM¿â£¬ÒýÈëADO¿â¶¨ÒåÎļþ
(2)ÓÃConnection¶ÔÏóÁ¬½ÓÊý¾Ý¿â
(3)ÀûÓý¨Á¢ºÃµÄÁ¬½Ó£¬Í¨¹ýConnection¡¢Command¶ÔÏóÖ´ÐÐSQLÃüÁ»òÀûÓÃRecordset¶ÔÏóÈ¡µÃ½á¹û¼Ç
¼¼¯½øÐвéѯ¡¢´¦Àí¡£
(4)ʹÓÃÍê±Ïºó¹Ø±ÕÁ¬½ÓÊͷŶÔÏó¡£
ÎÒÃÇ¿ÉÒÔʹÓÃAfxOleInit()À´³õʼ»¯COM¿â£¬ÕâÏ×÷ͨ³£ÔÚCWinApp::InitInstance()µÄÖØÔغ¯ÊýÖÐÍê
³É£¬Çë¿´ÈçÏ´úÂë:
BOOL CADOTest1App::InitInstance()
{
AfxOleInit();
......
}
ÎÒÃÇÔÚstdafx.hÖмÓÈëÈçÏÂÓï¾ä£º
#import "c:\program files\common files\system\ado\msado15.dll" no_namespace rename("EOF","adoEOF")
Æä×îÖÕ×÷ÓÃͬÎÒÃÇÊìϤµÄ#includeÀàËÆ,±àÒëµÄʱºòϵͳ»áΪÎÒÃÇÉú³Émsado15.tlh,ado15.tliÁ½¸öC++Í·ÎļþÀ´¶¨ÒåADO¿â¡£
Ê×ÏÈÎÒÃÇÐèÒªÌí¼ÓÒ»¸öÖ¸ÏòConnection¶ÔÏóµÄÖ¸Õë:
_ConnectionPtr m_pConnection;
BOOL CADOTest1Dlg::OnInitDialog()
{
CDialog::OnInitDialog();
try
{
HRESULT hr = m_pConnection.CreateInstance("ADO
Ïà¹ØÎĵµ£º
1.ÒýÑÔ
¡¡¡¡C++ÓïÑԵĴ´½¨³õÖÔÊÇ“a better C”£¬µ«ÊÇÕâ²¢²»Òâζ×ÅC++ÖÐÀàËÆCÓïÑÔµÄÈ«¾Ö±äÁ¿ºÍº¯ÊýËù²ÉÓõıàÒëºÍÁ¬½Ó·½Ê½ÓëCÓïÑÔÍêÈ«Ïàͬ¡£×÷ΪһÖÖÓûÓëC¼æÈݵÄÓïÑÔ£¬C++±£ÁôÁËÒ»²¿·Ö¹ý³ÌʽÓïÑÔµÄÌص㣨±»ÊÀÈ˳ÆΪ“²»³¹µ×µØÃæÏò¶ÔÏ󔣩£¬Òò¶øËü¿ÉÒÔ¶¨Òå²»ÊôÓÚÈκÎÀàµÄÈ«¾Ö±äÁ¿ºÍº¯Êý¡£µ«ÊÇ£¬C++±Ï¾ ......
C£¬C++ÍøÂç±à³Ìѧϰ¼òÃ÷Ö¸ÄÏ
1. ÔúʵµÄC£¬C++»ù´¡ÖªÊ¶
²Î¿¼×ÊÁÏ¡¶C³ÌÐòÉè¼Æ¡·£¬¡¶C++ primer¡·¡£
2. TCP/IPÐÒé
¾µäÊéÊÇ£ºW.Richard Stevens Öø¡¶TCP/IPÏê½â¡·Èý¾íÊ飬¾í1ÊÇÐÒ飬¾í2ÊÇʵÏÖ£¬¾í3ÊÇTCPÊÂÎñÐÒéµÈ¡£»¹Óйٷ½µÄÐÒéÎĵµ£ºRFC
µ±È»Ò²¿ÉÒÔÔÚÍøÉÏÏÂÔصç×ÓÊé¡£
¾µäµÄ¿ªÔ´ÐÒé·ÖÎö¹¤¾ß£ºWireshark.
......
va_listÊÇc/c++ÓïÑÔÎÊÌâÖнâ¾ö¿É±ä²ÎÊýµÄÒ»×éºê.ÏÈÀ´¿´Ò»¸ö³ÌÐòÀý×Ó°É.
view plaincopy to clipboardprint?
#include <stdarg.h>
/**¡¡º¯ÊýÃû£ºmax
*¡¡¹¦ÄÜ£º·µ»Øn¸öÕûÊýÖеÄ×î´óÖµ
* ²ÎÊý£ºnum£ºÕûÊýµÄ¸öÊý . ......
ÒýÑÔ
¡¡¡¡C/C++ÓïÑÔÓÐÒ»¸ö²»Í¬ÓÚÆäËüÓïÑÔµÄÌØÐÔ£¬¼´ÆäÖ§³Ö¿É±ä²ÎÊý£¬µäÐ͵ĺ¯ÊýÈçprintf¡¢scanfµÈ¿ÉÒÔ½ÓÊÜÊýÁ¿²»¶¨µÄ²ÎÊý¡£È磺
printf ( "I love you" );
printf ( "%d", a );
printf ( "%d,%d", a, b );
¡¡¡¡µÚÒ»¡¢¶þ¡¢Èý¸öprintf·Ö±ð½ÓÊÜ1¡¢2¡¢3¸ö²ÎÊý£¬ÈÃÎÒÃÇ¿´¿´printfº¯ÊýµÄÔÐÍ£º
int printf ( const ......
#include "iostream.h"
#include "stdio.h"
#import "C:\program files\common files\system\ado\msado15.dll" no_namespace rename("EOF","adoEOF")
int main(int argc, char* argv[])
{
::CoInitialize(NULL);
_ConnectionPtr m_pConnection;
m_pConnection.CreateInstance("ADODB.Connection");
tr ......