ADODB Calling stored Procedures

Source: Internet
Author: User

The Append parameter method calls the stored procedure append parameter through the CreateParameter method, which is used to specify the property to create a new Parameter object. The specific syntax is as follows: Set parameter = command. CreateParameter (Name, Type, Direction, Size, Value) · Name Optional, string that represents the Parameter object name. Type optional, long integer value that specifies the Parameter object data type. Direction optional, long integer value specifying the Parameter object type. The Size is an optional, Long value that specifies the maximum length of the parameter value, in characters or bytes. •  Value Optional, Variant, specifying the Parameter object value.  The main difference between this method and the above method is that the method of appending parameters, when passing parameters to the stored procedure, first creates the parameters for the stored procedure through the CreateParameter method, and then appends the created parameters to the Parameters collection through the Append method. The key code is still the example of a stored procedure Doc_procname call: Dim Mrst as ADODB. The recordset ' Recordset object represents the complete collection of records from the underlying table or command execution results. Dim PRM as ADODB. The Parameter ' Parameter object represents a parameter or parameter associated with a command object that is based on a parameterized query or stored procedure. Adoconn. ConnectionString = adodc1.connectionstring adoconn. Openset Adocomm. ActiveConnection = adoconn Adocomm.commandtext = "Doc_procname" Adocomm.commandtype = adCmdStoredProc Set PRM = Adocomm. CreateParameter ("Parameter1", Adtinyint, adParamInput,, "1") Adocomm. Parameters.Append prmset PRM = Adocomm. CreateParameter ("Parameter2", Adinteger, adParamOutput) Adocomm. Parameters.Append Prmset MRst = Adocomm. Executereturnvalue = Adocomm. Parameters (0)

ADODB calling stored procedures

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.