VBÖÐʹÓÃADODB²Ù×÷Êý¾Ý¿â£¨2£©_VB.net_ºÚ¿Í·ÀÏßÍø°²·þÎñÆ÷ά»¤»ùµØ--Powered by WWW.RONGSEN.COM.CN

VBÖÐʹÓÃADODB²Ù×÷Êý¾Ý¿â£¨2£©

×÷ÕߣººÚ¿Í·ÀÏßÍø°²VB½Ì³Ì»ùµØ À´Ô´£ººÚ¿Í·ÀÏßÍø°²VB½Ì³Ì»ùµØ ä¯ÀÀ´ÎÊý£º0

±¾Æª¹Ø¼ü´Ê£ºÊý¾Ý¿â²Ù×÷ʹÓà
ºÚ¿Í·ÀÏßÍø°²ÍøѶ£º¡¡¡¡rs.Close  'Õâ¸ö·½·¨ÓÃÀ´¹Ø±ÕÄãËù´ú¿ªµÄ±í£¬Èç¹û²»Ê¹ÓÃÕâ¸ö·½·¨Ò²¿ÉÒÔ£¬µ«ÊÇÊý¾Ý¿âÈÔÈ»ÈÏΪÄãÔÚ¶Ô±ê½øÐÐËø¶¨£¬¿ÉÔì³ÉÊý¾Ý¿â¸ºµ£¹ýÖØ2¡¢¶ÔÊý¾Ý½øÐÐɸѡºÍÅÅÐò======================...

¡¡¡¡rs.Close  'Õâ¸ö·½·¨ÓÃÀ´¹Ø±ÕÄãËù´ú¿ªµÄ±í£¬Èç¹û²»Ê¹ÓÃÕâ¸ö·½·¨Ò²¿ÉÒÔ£¬µ«ÊÇÊý¾Ý¿âÈÔÈ»ÈÏΪÄãÔÚ¶Ô±ê½øÐÐËø¶¨£¬¿ÉÔì³ÉÊý¾Ý¿â¸ºµ£¹ýÖØ

2¡¢¶ÔÊý¾Ý½øÐÐɸѡºÍÅÅÐò
=======================
Sql = "select * from ±íÃû" 'SQL²éѯÓï¾ä
'ÒÔÉÏΪ´ò¿ªÒ»¸ö±íµÄËùÓÐÄÚÈÝ

Sql = "select top 50 * from ±íÃû" 'SQL²éѯÓï¾ä
'ÒÔÉÏΪֻ´ò¿ªÇ°50ÐеļǼ

Sql = "select top 50 ÁÐÃû1,ÁÐÃû2,ÁÐÃû5 from ±íÃû" 'SQL²éѯÓï¾ä
'ÒÔÉÏΪֻ´ò¿ªÇ°50ÐеļǼ£¬²¢ÇÒÖ»´ò¿ªµÚ1¡¢2¡¢5ÁÐÊý¾Ý

Sql = "select * from ±íÃû where ÁÐÃû1='" & ×ֶΠ& "'" 'SQL²éѯÓï¾ä
'ÒÔÉÏΪһ¸ö¼òµ¥µÄɸѡ£¬±íʾ´ò¿ªµÄÄÚÈݱØÐë·ûºÏ[ÁÐÃû1='" & ×ֶΠ& "'"]µÄÄÚÈÝ
'ÐèҪעÒâµÄÊÇ£¬Êý¾Ý¿âÁеÄÀàÐͱØÐëÆ¥Å䣬±ÈÈç×Ö·û´®ÀàÐÍÐèÒªÒÔµ¥ÒýºÅÀ¨Æð
'¶øÊý×ÖÀàÐÍÔò²»ÄÜÓõ¥ÒýºÅÀ¨Æð
'ÁíÍâSQLÓï¾ä»¹Ö§³ÖͨÅä·û£¬ÀýÈç ÁÐÃû1 like '%" & ×ֶΠ& "%'" ±íʾ°üº¬[×Ö¶Î]
'ÔÚ±í´ïʽÖеÄÆ¥Åä
'? _£¨Ï»®Ïߣ© Èκε¥Ò»×Ö·û
'* or %        Áã¸ö»ò¶à¸ö×Ö·û
'#             Èκε¥Ò»Êý×Ö£¨0 ¡ª 9£©
'[charlist]    ÈκÎÔÚ×Ö·û±íÖеĵ¥Ò»×Ö·û
'[!charlist]   Èκβ»ÔÚ×Ö·û±íÖеĵ¥Ò»×Ö·û
'×¢£º¸ù¾ÝÊý¾Ý¿âµÄ²»Í¬?¡¢_ºÍ*¡¢%µÄÓ¦ÓÃÓÐËù²î±ð£¬±ÈÈçSQLֻʹÓÃ% ºÍ _ ·Ö±ð´ú±í¶à¸ö×Ö·ûºÍµ¥Ò»×Ö·û

Sql = "select * from ±íÃû where ÁÐÃû1='" & ×ֶΠ& "' ORDER BY ×Ö¶Î1 ASC" '¶Ô²éѯ½á¹û½øÐÐÉýÐòÅÅÁÐ
Sql = "select * from ±íÃû where ÁÐÃû1='" & ×ֶΠ& "' ORDER BY ×Ö¶Î1 DESC"  '¶Ô²éѯ½á¹û½øÐнµÐòÅÅÁÐ
Sql = "select * from ±íÃû where ÁÐÃû1='" & ×ֶΠ& "' ORDER BY ×Ö¶Î1 DESC, ORDER BY ×Ö¶Î2 DESC"  '¶Ô²éѯ½á¹û½øÐжàά½µÐòÅÅÁУ¨ËÙ¶ÈÆæÂý£¬²»ÍƼöʹÓã©

3¡¢Recordset¼¯ºÏµÄ³£ÓÃÊôÐÔ·½·¨
==============================
rs.BOF        'ÊÇ·ñÓαêÔÚ×îÉϱß
rs.EOF        'ÊÇ·ñÓαêÔÚ×îϱß
rs.RecordCount    '¼Ç¼¼¯µÄÐÐÊý£¨Èç¹ûʹÓÃÏñÇ°ÀàÐ͵ÄÓα꣬¿ÉÄÜ·µ»Ø²»×¼È·£©
rs.AddNew    'н¨Ò»ÐмǼ
rs.Update    '±£´æµ±Ç°Ðб»Ð޸ĵļǼ
rs.Delete    'ɾ³ýµ±Ç°ÐÐ
rs.Close    '¹Ø±Õ¼Ç¼¼¯

4¡¢Fields¼¯ºÏµÄһЩÊôÐԵĽâÊÍ
=============================
'ÒÔÏÂΪ¼òд£¬Õý³£Çé¿öÐèÒªrs.Fileds.¡£¡£¡£µ«ÊÇFieldsÊôÓÚRecordsetµÄÒ»¸öĬÈϼ¯ºÏ£¬Òò´Ë¿ÉÒÔÊ¡ÂÔ

rs()  'À¨ºÅÄÚ¿ÉÒÔÊÇÁÐÃûÒ²¿ÉÒÔÊÇÁеÄÐòºÅÀýÈ磺rs("ÐÕÃû")¡¢rs(3) ¶¼ÊÇÊÇ¿ÉÒÔµÄ

rs(3).Name  '·µ»ØÁÐÃû
rs(3).Type  '·µ»ØÁеÄÀàÐÍ
rs(3).Value '·µ»Øµ±Ç°ÐеÄÖµ
rs.Fields.Count '·µ»ØÁÐÊý

    ºÚ¿Í·ÀÏßÍø°²·þÎñÆ÷ά»¤·½°¸±¾ÆªÁ¬½Ó£ºhttp://www.rongsen.com.cn/show-14809-1.html
Íøվά»¤½Ì³Ì¸üÐÂʱ¼ä:2012-04-03 01:14:54  ¡¾´òÓ¡´ËÒ³¡¿  ¡¾¹Ø±Õ¡¿
ÎÒÒªÉêÇë±¾Õ¾£ºNµã | ºÚ¿Í·ÀÏß¹ÙÍø |  
רҵ·þÎñÆ÷ά»¤¼°Íøվά»¤ÊÖ¹¤°²È«´î½¨»·¾³£¬ÍøÕ¾°²È«¼Ó¹Ì·þÎñ¡£ºÚ¿Í·ÀÏßÍø°²·þÎñÆ÷ά»¤»ùµØÕÐÉ̽øÐÐÖУ¡QQ:29769479

footer  footer  footer  footer