ADOÈý´ó¶ÔÏóµÄÊôÐÔ¡¢·½·¨¡¢Ê¼þ¼°³£Êý£¨¶þ£©
Command¶ÔÏóCommand¶ÔÏóµÄÖ÷ҪĿµÄÊÇÖ´ÐвÎÊý»¯µÄ´æ´¢¹ý³Ì¡£ÆäÐÎʽҪôÊÇÁÙʱ׼±¸(prepared£©£¬ÒªÃ´Êdz־õÄÔ¤±àÒ루precompiled£©¹ýµÄSQLÓï¾ä¡£Èç¹ûÏ루´æ´¢£©Ò»¸ö»ò¶à¸ö²éѯÒÔ¹©ÔÚͬһConnectionÉ϶à´ÎÖ´ÐУ¬Command¶ÔÏóÒ²ÊǺÜÓÐÓõġ£µ±Ïë´´½¨Recordsetʱ£¬Ò»ÖÖ¸ßЧµÄ·½·¨ÊÇÈƹýCommand¶ÔÏó¶ø²ÉÓÃRecordset.Open·½·¨¡£ ÊôÐÔ ÊôÐÔÃû³Æ Êý¾ÝÀàÐͺÍÓÃ; ActiveConnection Ö¸ÕëÀàÐÍ£¬Ö¸ÏòCommandËù¹ØÁªµÄConnection¶ÔÏ󡣶ÔÓÚÏÖ´æµÄÒÑ´ò¿ªÁ¬½Ó£¬¿ÉʹÓÃSet cmmName.ActiveConnection=cnnName¡£ÁíÍ⣬Ҳ¿ÉÒÔ²»ÓÃÏà¹ØConnection¶ÔÏóÃû³Æ¶øʹÓÃÓÐЧµÄÁ¬½Ó×Ö·û´®È¥´´½¨Ò»¸öеÄÁ¬½Ó¡£Ä¬ÈÏֵΪNull¡£ CommandText ¿É¶ÁдStringÀàÐÍ¡£ÎªActiveConnectionÖ¸¶¨Ò»ÌõSQLÓï¾ä¡¢±íÃû¡¢´æ´¢¹ý³ÌÃû»òÌṩÕßÄܽÓÊܵÄÈÎÒâ×Ö·û´®¡£CommandTypeÊôÐÔµÄÖµ¾ö¶¨ÁËCommandTextÊôÐÔÖµµÄ¸ñʽ¡£Ä¬ÈÏֵΪ¿Õ×Ö·û´®£º"" CommandTimeout ¿É¶ÁдLongÀàÐÍ£¬Ö¸¶¨ÖÐÖ¹Ò»¸öCommand.Executeµ÷ÓÃ֮ǰ±ØÐëµÈ´ýµÄʱ¼ä¡£ÕâʱµÄÖµÓÅÏÈÓÚConnection.ComandTimeoutÖеÄÉ趨ֵ¡£Ä¬ÈÏֵΪ30Ãë¡£ CommandType ¿É¶ÁдLongÀàÐÍ£¬Ö¸¶¨Êý¾ÝÌṩÕ߸ÃÈçºÎ½âÊÍCommandTextÊôÐÔÖµ¡£CommandTypeµÈЧÓÚConnection.Execute·½·¨ÖеĿÉÑ¡²ÎÊýlngOption¡£Ïê¼ûCommandTypeËùÓõ½µÄ³£Êý¡£Ä¬ÈÏֵΪadCmdUnkown. Name ¿É¶ÁдStringÀàÐÍ£¬Ö¸¶¨CommandµÄÃû³Æ¡£ Prepared ¿É¶ÁдBooleanÀàÐÍ£¬ÅжÏÊý¾ÝÔ´ÊÇ·ñ°ÑCommandTextÖеÄSQLÓï¾ä±àÒëΪprepared statement£¨Ò»ÖÖÁÙʱÐÔ´æ´¢¹ý³Ì£©¡£prepared statement½ö´æ»îÓÚCommandµÄActiveConnectionÉúÃüÖÜÆÚÖС£Ðí¶à¿Í»§£¯·þÎñÆ÷RDBMS£¬°üÀ¨SQL SERVER£¬¶¼Ö§³Öprepared statement¡£Èç¹ûÊý¾ÝÔ´²»Ö§³Öprepared statement,Ôò°Ñ¸ÃÊôÐÔÉèΪTrue£¬½«µ¼ÖÂÒ»¸ö×ÔÏÝ´íÎó¡£ State ¿É¶ÁдLongÀàÐÍ£¬Ö¸¶¨Commnad״̬¡£¼ûState³£Êý¡£ ×¢Ò⣺×îºÃÿ´Î¶¼ÎªCommandTypeÖ¸¶¨µÄÒ»¸öºÏÊʵij£ÊýÖµ£¬·ñÔò»á½µµÍϵͳÔËÐеÄЧÂÊ¡£ ·½·¨ ·½·¨ ÓÃ; Createparameter ÔÚÖ´Ðи÷½·¨Ö®Ç°£¬±ØÐëÊ×ÏÈÉùÃ÷Ò»¸öADODB.Parameter¶ÔÏó¡£µ÷ÓÃÓ﷨Ϊ£º cmmName.CreateParameter [strName[,lngType[,lngDirection[,lngSize[,varValue]]]]] Execute µ÷ÓÃÓ﷨ͬConnection.Execute´óÖÂÏàͬ¡£ ³£Êý State³£Êý ³£Êý º¬Òå adStateClosed Connection(»òÆäËû¶ÔÏó)ÊǹرյÄ(ĬÈÏÖµ) adStateConnecting ÕýÔÚÁ¬½ÓÊý¾ÝÔ´µÄ״̬ adStateExecuting Connection»òCommand¶ÔÏóµÄExecute·½·¨Òѱ»µ÷Óà adStateFetching ·µ»ØÐÐ(row)µ½Recordset¶ÔÏó adStateOpen Connection(»òÆäËû¶ÔÏó)ÊÇ´ò¿ªµÄ(»î¶¯µÄ) CommandTypeËùÓõ½µÄ³£Êý CommandÀàÐͳ£Êý º¬Òå adCmdUnknown CommandÀàÐÍ䶨£¨Ä¬ÈÏÖµ£©£¬ÓÉÊý¾ÝÌṩÕßÈ¥ÅбðCommandÓï·¨ adCmdFile CommandÊǺͶÔÏóÀàÐÍÏàÓ¦µÄÎļþÃû³Æ adCmdStoredProc CommandÊÇ´æ´¢¹ý³ÌÃû³Æ adCmdTable CommandÊÇÄܲúÉúÄÚ²¿SELECT * FROM TableName²éѯµÄ±íÃû³Æ adCmdTableDirect CommandÊÇÄÜÖ±½Ó´Ó±íÖлñÈ¡ÐÐÄÚÈݵıíÃû³Æ adCmdText CommandÊÇÒ»ÌõSQLÓï¾ä
--------------------------------------------------------------------------------
Ïà¹ØÎÄÕÂ
SQL SERVER»ù±¾¸ÅÄîѧϰӡÏó 2004-1-1 21:23:13
ERwin--¼ò»¯µÄÊý¾Ý¿âÉè¼Æ¹¤¾ß 2003-12-15 12:41:40
ÔÚºêÌõ¼þÖÐÅжϴ°Ìåβ¼Ç¼ 2003-11-20 16:25:48
Á˽â Microsoft Access °²È«ÐÔ 2003-11-13 11:21:08
²»µ±±àдSQLÓï¾äµ¼ÖÂϵͳ²»°²È« 2003-11-13 10:55:26
ʹÓà Jet UserRoster ¼ì²éÊÇ˵Ǽµ½Êý¾Ý¿âÖÐ 2003-10-18 9:54:42
´´½¨ÍêÃÀ±¨±í 2003-10-17 19:37:17
SQL SERVER ÓëACCESS¡¢EXCELµÄÊý¾Ýת»» 2003-10-17 19:12:00
¶¯Ì¬Ìí¼Ó»òɾ³ýÒýÓà 2003-10-17 19:01:02
MS Jet SQL for Access 2000Öм¶Æª(IV) 2003-10-17 18:52:20
MS Jet SQL for Access 2000Öм¶Æª (III) 2003-10-17 18:51:47
MS Jet SQL for Access 2000Öм¶Æª (II) 2003-10-17 18:51:01
MS Jet SQL for Access 2000Öм¶Æª (I) 2003-10-17 18:47:38
ʹÓÃADOÁ¬½Óµ½·À»ðǽºóµÄSQL Server 2003-10-17 18:43:57
ADOÁ¬½ÓÊý¾Ý¿â×Ö·û´®´óÈ« 2003-10-17 18:40:47
VBAÖгõʼ»¯ADOÁ¬½ÓµÄ¼¸ÖÖ·½·¨ 2003-10-14 8:46:43
ÓÃADOÀ´Ñ¹ËõÊý¾Ý¿â 2003-10-14 8:46:12
ADOÈý´ó¶ÔÏóµÄÊôÐÔ¡¢·½·¨¡¢Ê¼þ¼°³£Êý£¨Èý£© 2003-10-14 8:44:20
ADOÈý´ó¶ÔÏóµÄÊôÐÔ¡¢·½·¨¡¢Ê¼þ¼°³£Êý£¨Ò»£© 2003-10-14 8:43:26
ÈçºÎÕï¶Ï/ÐÞ¸´Ëð»µµÄ Jet 4.0 Êý¾Ý¿â 2003-10-14 8:31:26
ÌáÉýÇ°ºǫ́ģʽ³ÌÐòµÄËÙ¶È 2003-10-10 10:17:08
»ñÈ¡Ö¸¶¨±íËùÓÐ×Ö¶ÎÃûµÄº¯Êý 2003-10-6 16:44:38
Ò»¸ö¼òµ¥µÄAdoÓ÷¨Ê¾Àý 2003-10-6 16:24:38
Êý¾Ý¿âÓ¦ÓóÌÐòÐè×¢ÒâµÄÎÊÌâ 2003-10-6 11:11:06
|