ADO Command object - Prepared Property

Home | About me | EXCEL VB Programming (XL97-2003) | ACCESS Programming | EXCEL VB.Net Programming | EXCEL Spreadsheet Functions Material Management  |  Guestbook
 

ADO Prepared Property

The Prepared property sets or returns a Boolean value that, if set to True, indicates that the command should save a prepared version of the query specified in the CommandText property before execution.

This could slow down the command's first execution, but after the first execution the provider will use the compiled version, which results in a faster execution.

Syntax

objcommand.Prepared=true or false

 

Example

Code:
set conn=New ADODB.Connection
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "f:/Mydata/northwind.mdb"
set comm=New ADODB.Command
comm.ActiveConnection=conn
comm.CommandText="Customers"
comm.Prepared=true
response.write(comm.Prepared)
conn.close
 
Code:
Set objCommand.ActiveConnection = objConnection
objCommand.Prepared = True

'... some code

objCommand.Execute