ADO Primer: Evaluating the Command.Prepared Property


This example demonstrates use of the Prepared property by opening two Command objects one prepared and one not prepared both representing a multiple-table join query with aggregate functions. To test, execute the commands a given number of times.
Number of times to execute the commands (1 - 100):
Performance Results at 1 calls:
Not Prepared Prepared
0.0313 seconds 0.0000 seconds

The SQL Source of the Command object is as follows:

SELECT DISTINCT LastName, FirstName, Title, Sum(Quantity) AS [Total Units], Sum(UnitPrice*Quantity) AS [Total Sales] FROM (Employees RIGHT JOIN Orders2 ON Employees.EmployeeID = Orders2.EmployeeID) INNER JOIN Order_Details2 ON Orders2.OrderID = Order_Details2.OrderID GROUP BY LastName, FirstName, Title ORDER BY Sum(UnitPrice*Quantity) DESC
The test evaluates how long it takes in both cases to execute each Command object a given number of times.

Go Top   |   Return to DB101 ADO Samples