How ASP creates multiple command objects

Source: Internet
Author: User

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:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.