The query string must first be examined before you can determine the number of parameters and their individual data types.
<% cm.Parameters.Refresh%>
Save yourself time by declaring the parameter objects manually instead of calling the refresh method. (Using Prepared Commands)
- Before queries are actually executed by the data provider on the database server, they are examined, optimized, and compiled into a pseudo-code that's later used to drive the data-retrieval system.
- To Prepare a Command Object, set the Prepared property to true.
Example
set cm.CommandText = "Update school set school_name = ? where id
= ?"
cm.CommandType = adCmdText
cm.Prepared =true
cm.Parameters.append cm.CreateParameter("name",adChar,adParamInput,50)
cm.Parameters.append cm.CreateParameter("school_id, adInteger, adParamInput)
cm("name")="Golden Lion"
cm("id") = 1
cm.execute
cm("name")="kenpo"
cm("id")=2
cm.execute
Stored Procedures
To call a stored procedure, the Parameter collection must be set to precisely
match the number and type of parameters defined on the server.
Comments