prepare( ) example
In this example, a query is executed using a value that is entered by the user. You can prepare the query first, placing the parameter in the SQL statement with a colon in front of it:
q = new Query( )
q.database = someDatabase
q.sql = "select * from EMPLOYEE where EMP_ID = :id"
q.prepare( )
Then when the user enters the value of the parameter, you assign it to the query’s params array and execute the query:
q.params[ "id" ] = someForm.empIdText.value
q.active = true
Because the query has already been prepared, making it active takes less time. Later, when the parameter changes, you reassign the parameter and requery:
q.params[ "id" ] = someForm.empIdText.value
q.requery( )