In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Editor to share with you how ado calls stored procedures, I hope you will learn something after reading this article. Let's discuss it together.
You can install the ADO call stored procedure. But it doesn't have as many functions as Oracle or Microsoft. And, of course, Data Direct has a local data provider for Oracle. Can be installed in Visual Studio. But it doesn't have as many functions as Oracle or Microsoft.
Calling stored procedures in ADO has always been a perplexing problem. In fact, the method of calling stored procedures by ADO has been mentioned in many books, and the standard practice is to follow these steps:
1. Generate and initialize a _ CommandPtr object
2. Generate the parameters needed to call the stored procedure, all of which are _ ParameterPtr objects
3. In order, the Append method of _ CommandPtr will be used to provide parameters to the stored procedure (including input parameters and output parameters)
4. Specify the ADO connection that needs to be used for the _ CommandPtr object
5. Use the Execute method of _ CommandPtr to call the stored procedure
6. Get the value of the return parameter (if any) from the result. I will not describe the specific process in detail here, but I would like to take a look at the code attached to this article. Here I would like to explain some of my experience when calling stored procedures using ADO.
1. About CreateParameter function
The prototype of this function is CreateParameter (Name, Type, Direction, Size, Value), where Name is the name of the parameter, which can be specified or not specified.
Type is a DataTypeEnum value that specifies the category of parameters, such as adInteger (integer), adChar (string / string type), etc. ADO call stored procedure Direction is a ParameterDirectionEnum value, whose values are adParamInput, adParamInputOutput, adParamOutput, adParamReturnValue, adParamUnknown;Size are values of type Long, indicating the * length of the parameter calculated in bytes, for example, for int type, the value can be taken as sizeof (int)
For long type, the value can be taken as sizeof (long), ADO calls stored procedure for string type, you can use the length of the string; Value is a value of type variant, which is the value of this parameter. It should be noted here that the Type parameters, Direction parameters, and Size parameters must match the parameters defined by the stored procedure.
For example, if you have the following stored procedure:
CREATE PROCEDURE SMS_Proc_Handle_All (@ UserID Integer, @ SourAddr Varchar (15), @ DestAddr varchar (5000), @ AvValue Single output, @ ReturnInfo varchar (100) output has finished reading this article. I believe you have some understanding of "how to call stored procedures by ado". If you want to know more about it, welcome to follow the industry information channel. Thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.