VC++ÖÐʹÓÃADO·½Ê½²Ù×÷ACCESSÊý¾Ý¿â
ת×Ô£ºhttp://dev.yesky.com/243/2230743.shtml
ADO(ActiveX Data Object)ÊÇMicrosoftÊý¾Ý¿âÓ¦ÓóÌÐò¿ª·¢µÄнӿڣ¬Êǽ¨Á¢ÔÚOLE DBÖ®Éϵĸ߲ãÊý¾Ý¿â·ÃÎʼ¼Êõ£¬¼´Ê¹Äã¶ÔOLE DB£¬COM²»Á˽âÒ²ÄÜÇáËɶԸ¶ADO,ÒòΪËü·Ç³£¼òµ¥Ò×Óã¬ÉõÖÁ±ÈÄãÒÔÍùËù½Ó´¥µÄODBC API¡¢DAO¡¢RDO¶¼ÒªÈÝÒ×ʹÓ㬲¢²»Ê§Áé»îÐÔ¡£±¾ÎÄÏêϸµØ½éÉÜÔÚVisual C++¿ª·¢»·¾³ÏÂÈçºÎʹÓÃADOÀ´½øÐÐÊý¾Ý¿âÓ¦ÓóÌÐò¿ª·¢£¬²¢¸ø³öʾÀý´úÂ롣ΪÁËʹ¶ÁÕßÅóÓѶ¼ÄܲâÊÔ±¾ÀýÌṩµÄ´úÂ룬ÎÒÃDzÉÓÃAccessÊý¾Ý¿â£¬Äú¿ÉÒÔÖ±½ÓÔÚÎÒÃÇÌṩµÄʾÀý´úÂëÖÐÕÒµ½Õâ¸ötest.mdb¡£³ÌÐò±àÒëÔËÐкóµÄЧ¹ûÈçͼһËùʾ£º
ͼһ¡¢ADO²Ù×÷ACESSÊý¾Ý¿âµÄ½çÃæЧ¹ûͼ
¡¡¡¡Ò»¡¢ÊµÏÖ·½·¨
¡¡¡¡ÍòÊ¿ªÍ·ÄÑ£¬ÈκÎÒ»ÖÖм¼Êõ¶ÔÓÚ³õѧÕßÀ´Ëµ×îÖØÒªµÄ»¹ÊÇ"ÈëÃÅ"£¬ÕÆÎÕÆäÒªµã¡£ÈÃÎÒÃÇÀ´¿´¿´ADOÊý¾Ý¿â¿ª·¢µÄ»ù±¾Á÷³Ì°É£¡ËüµÄ»ù±¾²½ÖèÈçÏ£º
¡¡¡¡£¨1£©³õʼ»¯COM¿â£¬ÒýÈëADO¿â¶¨ÒåÎļþ
¡¡¡¡£¨2£©ÓÃConnection¶ÔÏóÁ¬½ÓÊý¾Ý¿â
¡¡¡¡£¨3£©ÀûÓý¨Á¢ºÃµÄÁ¬½Ó£¬Í¨¹ýConnection¡¢Command¶ÔÏóÖ´ÐÐSQLÃüÁ»òÀûÓÃRecordset¶ÔÏóÈ¡µÃ½á¹û¼Ç¼¼¯½øÐвéѯ¡¢´¦Àí¡£
¡¡¡¡£¨4£©Ê¹ÓÃÍê±Ïºó¹Ø±ÕÁ¬½ÓÊͷŶÔÏó¡£
¡¡¡¡ÏÂÃæÎÒÃǽ«Ïêϸ½éÉÜÉÏÊö²½Öè²¢¸ø³öÏà¹Ø´úÂë¡£
¡¡¡¡1¡¢COM¿âµÄ³õʼ»¯
¡¡¡¡ÎÒÃÇ¿ÉÒÔʹÓÃAfxOleInit()À´³õʼ»¯COM¿â£¬ÕâÏ×÷ͨ³£ÔÚCWinApp::InitInstance()µÄÖØÔغ¯ÊýÖÐÍê³É£¬Çë¿´ÈçÏ´úÂë:
BOOL CADOTest1App::InitInstance()
{
¡¡AfxOleInit();
¡¡......
}
¡¡¡¡2¡¢ÓÃ#importÖ¸ÁîÒýÈëADOÀàÐÍ¿â
¡¡¡¡ÎªÁËÒýÈëADOÀàÐͿ⣬ÐèÒªÔÚÏîÄ¿µÄstdafx.hÎļþÖмÓÈëÈçÏÂÓï¾ä£º
#import "c:\program files\common files\system\ado\msado15.dll"
no_namespace rename("EOF","adoEOF")
¡¡¡¡ÕâÒ»Óï¾äÓкÎ×÷ÓÃÄØ£¿Æä×îÖÕ×÷ÓÃͬÎÒÃÇÒѾʮ·ÖÊìϤµÄ#includeÀàËÆ£¬±àÒëµÄʱºòϵͳ»áΪÎÒÃÇÉú³Émsado15.tlh,ado15.tliÁ½¸öC++Í·ÎļþÀ´¶¨ÒåADO¿â¡£
¡¡¡¡ÐèÒª¶ÁÕßÅóÓÑ×¢ÒâµÄÊÇ£ºÄúµÄ¿ª·¢»·¾³ÖÐmsado15.dll²»Ò»¶¨ÔÚÕâ¸öĿ¼Ï£¬Ç밴ʵ¼ÊÇé¿öÐ޸ģ»ÔÚ±àÒëµÄʱºò¿ÉÄÜ»á³öÏÖÈçϾ¯¸æ£¬¶Ô´Ë΢ÈíÔÚMSDNÖÐ×÷ÁË˵Ã÷£¬²¢½¨ÒéÎÒÃDz»ÒªÀí»áÕâ¸ö¾¯¸æ£ºmsado15.tlh(405) : warning C4146: unary minus operator applied to unsigned type, result still unsigned¡£
¡¡¡¡3¡¢´´½¨Connection¶ÔÏó²¢Á¬½ÓÊý¾Ý¿â
¡¡¡¡ÎªÁËÊ×ÏÈÎÒÃÇÐèÒªÌí¼ÓÒ»¸öÖ¸ÏòConnection¶ÔÏóµÄÖ¸Õë_ConnectionPtr m_pConnection£¬ÏÂÃæµÄ´úÂëÑÝʾÁËÈçºÎ´´½¨Connection¶ÔÏóʵÀý¼°ÈçºÎÁ¬½ÓÊý¾Ý¿â²¢½øÐÐÒì
Ïà¹ØÎĵµ£º
ÏÈÇ°ÔÚ²âÊÔmysql connect c++½Ó¿ÚµÄʱºòÔËÐÐÆä¹Ù·½ÌṩµÄÀý×Ó
21.5.5.6. MySQL Connector/C++ Complete Example 2
The following code shows a complete example of how to use MySQL Connector/C++:
/* Copyright 2008 Sun Microsystems, Inc.
This program is free software; you can redistribute it and/or modify ......
ËäȻѧϰÁ˺öàÄê,µ«ÐèҪϸ¾¿Ä³Ð©»ù´¡ÖªÊ¶µÄʱºò»¹ÊÇ·¢ÏÖ×Ô¼ºÍüÁË, ´Ó±ðÈ˵ÄÎÄÕ°ǹýÀ´,ÒÔ±¸¸´Ï°
²Î¿¼: http://blog.csdn.net/masefee/archive/2009/12/28/5090820.aspx
============================================================
֮ǰµÄ¶¨Î»¿ÉÄÜÖ÷ҪΪÁËÑо¿µ×²ã¼°Ò»Ð©½Ï¸´ÔÓµÄÎÊÌâÉÏ£¬¶øºöÂÔÁËһЩ³õѧµÄÅóÓÑ¡£µ¼ ......
EBCDIC (Extended Binary Coded Decimal Interchange Code) À©Ôö¶þ½øʽʮ½ø½»»»Â룬ΪIBMÓÚ1963Äê£1964Äê¼äÍƳöµÄ×Ö·û±àÂë±í£¬¸ù¾ÝÔçÆÚ´ò¿×»úʽµÄ¶þ½ø»¯Ê®½øÊý(BCD, Bindary Coded Decimal)ÅÅÁжø³É¡£ÊÇIBMÃÔ¶û¼¶ÒÔÉϵçÄԵıê×¼Âë¡£
ASCII£¨American Standard Code for Information Interchange£¬ÃÀ¹úÐÅÏ¢»¥»»±ê×¼´úÂë£©Ê ......
1.·ÖÀà
ÄÚ²¿ÀàÐÍ ºÍÓû§¶¨ÒåÀàÐÍ
2.
ÕûÐΣºbool ,×Ö·ûÐÍ£¬ÕûÐÎ
true 1 flase 0
·ÇÁã true & ......