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
Ïà¹ØÎĵµ£º
CÓïÑÔÖÐÅÅÐòµÄËã·¨ÓкܶàÖÖ£¬ÏµÍ³Ò²ÌṩÁËÒ»¸öº¯Êýqsort()¿ÉÒÔʵÏÖ¿ìËÙÅÅÐò¡£ÔÐÍÈçÏ£º
void qsort(void *base, size_t nmem, size_t size, int (*comp)(const void *, const void *));
Ëü
¸ù¾ÝcompËùÖ¸ÏòµÄº¯ÊýËùÌṩµÄ˳Ðò¶ÔbaseËùÖ¸ÏòµÄÊý×é½øÐÐÅÅÐò£¬nmemΪ²Î¼ÓÅÅÐòµÄÔªËظöÊý£¬sizeΪÿ¸öÔªËØËùÕ¼µÄ×Ö½ÚÊý¡£Àý È ......
1.ÒýÑÔ
¡¡¡¡C++ÓïÑԵĴ´½¨³õÖÔÊÇ“a better C”£¬µ«ÊÇÕâ²¢²»Òâζ×ÅC++ÖÐÀàËÆCÓïÑÔµÄÈ«¾Ö±äÁ¿ºÍº¯ÊýËù²ÉÓõıàÒëºÍÁ¬½Ó·½Ê½ÓëCÓïÑÔÍêÈ«Ïàͬ¡£×÷ΪһÖÖÓûÓëC¼æÈݵÄÓïÑÔ£¬C++±£ÁôÁËÒ»²¿·Ö¹ý³ÌʽÓïÑÔµÄÌص㣨±»ÊÀÈ˳ÆΪ“²»³¹µ×µØÃæÏò¶ÔÏ󔣩£¬Òò¶øËü¿ÉÒÔ¶¨Òå²»ÊôÓÚÈκÎÀàµÄÈ«¾Ö±äÁ¿ºÍº¯Êý¡£µ«ÊÇ£¬C++±Ï¾ ......
ÎÊ:
È·ÈÏÒ»ÏÂc++Öв»ÄÜʹÓÃinterface£¨Èçjava£©ÄÇÑùµÄ¹¦ÄÜ°Ñ
ÎÒÈÏΪÊDz»Äܵģ¬×¢ÒâÎÒ˵µÄÊÇinterface£¨ÓÃÓÚjava¶àÖؼ̳еÄÄǸö£¬²»ÊÇÒ»°ãÒâÒåµÄ½Ó¿Ú£©
ÎÒ¾õµÃÊÇûÓеģ¬µ«ÊÇÍøÉÏËÑË÷˵ʲôµÄ¶¼ÓжøÇÒÈË»¹²»ÉÙ…… ËùÒÔÏ£Íû´ó¼ÒÄܸøÎÒÒ»¸öÃ÷È·µÄ´ð¸´ºÃô£¿×îºÃÄÜ»¹ÓÐһР......
½ñÌì¹éÄÉ×ܽáÒ»ÏÂÎļþ²Ù×÷º¯Êý¼°¸÷¸ö²ÎÊýµÄº¬Òå:
ÏȽéÉÜÒ»ÏÂc++µÄÎļþ²Ù×÷£¬ÎªÊ²Ã´Ëµc++µÄÎļþ²Ù×÷ÄØ£¬ÒòΪ¶ÔÓÚcÓïÑԵIJÙ×÷£¬Ò²ÓÐËüµÄº¯ÊýÖ®²»¹ý´óͬСÒì°ÕÁË¡£
ÔÚc++µÄÎļþ²Ù×÷ÖÐÓУ¬ÓÐÒ»¸öÀà¶ÔÎļþ²Ù×÷½øÐвÙ×÷£¬¼´CFile£¬ÏÂÃæ¾Íдһ¶Î´úÂ룬À´¼òµ¥µÄ½øÐнéÉÜ¡£
CFile cf;
char zhi[]={1,2};
&n ......
ÒýÑÔ
¡¡¡¡C/C++ÓïÑÔÓÐÒ»¸ö²»Í¬ÓÚÆäËüÓïÑÔµÄÌØÐÔ£¬¼´ÆäÖ§³Ö¿É±ä²ÎÊý£¬µäÐ͵ĺ¯ÊýÈçprintf¡¢scanfµÈ¿ÉÒÔ½ÓÊÜÊýÁ¿²»¶¨µÄ²ÎÊý¡£È磺
printf ( "I love you" );
printf ( "%d", a );
printf ( "%d,%d", a, b );
¡¡¡¡µÚÒ»¡¢¶þ¡¢Èý¸öprintf·Ö±ð½ÓÊÜ1¡¢2¡¢3¸ö²ÎÊý£¬ÈÃÎÒÃÇ¿´¿´printfº¯ÊýµÄÔÐÍ£º
int printf ( const ......