VB6 calls the Oracle Stored Procedure

Source: Internet
Author: User

The program compiled with VB6 10 years ago will be continuously used for repair, modification, and modification, and will continue to be used for several years.

I recently took over this program, except for the "sad reminder", I really cannot come up with other words to describe my mood.

A little nonsense. Recently, it took some time to call the stored procedure and finally solved the problem. I posted the result. If someone else is using VB6 like me, I hope it will be helpful.

 

This old program, when calling the Oracle stored procedure, can use different data engines according to the configuration, there are two optional
Provider = oraoledb. oracle.1
Provider = msdaora.1

 

The code for calling a stored procedure is as follows:

'Cndb. connectionstring = "provider = msdaora.1 ;... "
Cndb. Open
Cmd. activeconnection = cndb
Cmd. commandtype = adcmdstoredproc
Cmd. commandtext = "procname"

Cmd. parameters ("para1") = para1

Cmd. parameters ("para2") = para2

Cmd. Execute 'provider = oraoledb. oracle.1, an error is reported here.

Paraout = cmd ("out") 'the output parameter is of the string type.

 

If "provider = oraoledb. oracle.1" is used, the error "provider cannot export parameter information and setparameterinfo is not called" is reported when the stored procedure is called ".

If "provider = msdaora.1" is used, the stored procedure is called normally.

 

I checked some information and changed it to the following code, which can be called normally in either of the following ways:

'Cndb. connectionstring = "provider = msdaora.1 ;... "
Cndb. Open
Cmd. activeconnection = cndb
Cmd. commandtype = adcmdstoredproc
Cmd. commandtext = "procname"

Cmd. Parameters. append cmd. createparameter ("para1", adlongvarchar, adparaminput, 1000, para1)

Cmd. Parameters. append cmd. createparameter ("para2", adlongvarchar, adparaminput, 1000, para2)

Cmd. Execute 'provider = oraoledb. oracle.1, no error is reported

Paraout = cmd ("out") 'the output parameter is of the string type.

 

 

If a stored procedure returns a result set, the situation is more complex, see here: http://topic.csdn.net/t/20060323/15/4634977.html

Related Article

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.