1. Create multiple Command objects
DIM Mycomm
SET Mycomm = SERVER. CreateObject ("Adodb.command")
' Call a stored process
......
SET Mycomm = Nothing
SET Mycomm = SERVER. CreateObject ("Adodb.command")
' Call stored process two
......
SET Mycomm = Nothing
......
2. Create only one Command object and clear its arguments when the call is ended
DIM Mycomm
SET Mycomm = SERVER. CreateObject ("Adodb.command")
' Call a stored process
.....
' Clear parameters (assuming three parameters)
Mycomm. PARAMETERS. DELETE 2
Mycomm. PARAMETERS. DELETE 1
Mycomm. PARAMETERS. DELETE 0
' Call save process two and clear parameters
......
SET Mycomm = Nothing
Note that the order of the purge parameters is the opposite of the order of the parameter declarations, and I don't know why.
3. Reset the Parameter object using the Refresh method of the Parameters data collection
DIM Mycomm
SET Mycomm = SERVER. CreateObject ("Adodb.command")
' Call a stored process
.....
' Resets all parameter objects contained in the Parameters data collection
Mycomm. PARAMETERS. REFRESH
' Call stored process two
.....
SET Mycomm = Nothing
It is generally assumed that repeated creation of objects is a less efficient method, but tested (the test tool is Microsoft Application CENTER test), the result is unexpected: