用如下sql语句测试:
Select cCode from tbStocks
Group By cCode
Order By cCode.
跟踪Sql Server上执行情况,使用Query时为:
+SQL:BatchStarting SELECT ccode FROM tbStocks GROUP BY cCode ORDER BY ccode NEWLKF sa 2976 16 20:32:41.483
+SQL:StmtStarting SELECT ccode FROM tbStocks GROUP BY cCode ORDER BY ccode NEWLKF sa 0 2976 16 20:32:41.497
Select NEWLKF sa 0 2976 16 20:32:41.497
使用ADOQuery时,为:
+RPC:Starting sp_prepare @P1 output, NULL, N'SELECT * FROM tbStocks', 1 select @P1 Enterprise Suite NEWLKF sa 3009 24 20:18:05.717
+RPC:Completed sp_prepare @P1 output, NULL, N'SELECT * FROM tbStocks', 1 select @P1 Enterprise Suite NEWLKF sa 0 0 0 0 3009 24 20:18:05.717
+RPC:Starting sp_primary_keys_rowset N'tbStocks', NULL Enterprise Suite NEWLKF sa 3010 24 20:18:05.733
Select Enterprise Suite NEWLKF sa 0 3010 24 20:18:05.733
+RPC:Completed sp_primary_keys_rowset N'tbStocks', NULL Enterprise Suite NEWLKF sa 0 33 0 0 3010 24 20:18:05.733
+RPC:Starting sp_indexes_rowset N'tbStocks', NULL, NULL Enterprise Suite NEWLKF sa 3011 24 20:18:05.763
Select Enterprise Suite NEWLKF sa 0 3011 24 20:18:05.763
+RPC:Completed sp_indexes_rowset N'tbStocks', NULL, NULL Enterprise Suite NEWLKF sa 0 118 0 0 3011 24 20:18:05.763
+RPC:Completed sp_execute 3 Enterprise Suite NEWLKF sa 16 10 0 203 2981 23 20:18:05.687
其中ADOQuery执行效率大大的下降。也不知:sp_indexes_rowset 和 sp_primary_keys_rowset
是干啥子用的。(帮助上找不道)
以上请各路大侠参谋参谋..............