Check if Provider Supports Output Parameters from Stored Procedures

You can always write a stored procedure which can return some value in the form of parameters. This feature to return information from stored procedures in the form of parameters is very useful. But there are few things that you should consider before you try to use this feature. For instance, your provider may not support output parameters like it is not available in Access. Another important thing is that at what point the output parameters are available.

You can use “Output Parameter Availability” custom property of the connection object to check to see which of the options your provider supports. This property returns one of the following three values:
(a) 1 – Output parameters are not supported
(b) 2 – Output parameters are available after the command has been executed
(c) 4 – Output parameters are available only after the recordset has been closed

Here is a simple method that verifies whether your Provider supports output parameters and at what point. This method takes in a connection object as parameter and displays a message box about the availability of the output parameters.

 Private Sub CheckAvailabilityOfOutputParams(ByVal oConnection As ADODB.Connection)' Name of the PropertyConst DBPROP_OUTPUTPARAMETERAVAILABILITY As String = "Output Parameter Availability"' Values returned by the provider for the propertyConst DBPROPVAL_OA_NOTSUPPORTED As Long = &H1Const DBPROPVAL_OA_ATEXECUTE As Long = &H2Const DBPROPVAL_OA_ATROWRELEASE As Long = &H4 On Error GoTo ErrorHandler' The time at which output parameter values become available. One of the following:Select Case oConnection.Properties(DBPROP_OUTPUTPARAMETERAVAILABILITY)Case DBPROPVAL_OA_NOTSUPPORTEDMsgBox "Output parameters are not supported"Case DBPROPVAL_OA_ATEXECUTEMsgBox "Output parameters are available immediately after the call to Command.Execute() method"Case DBPROPVAL_OA_ATROWRELEASEMsgBox "Output parameters are available only after the recordset has been closed"End SelectExit SubErrorHandler:' Display error messageMsgBox "Error Number = " & Err.Number & ", Description = " & Err.Description, _vbCritical, "Output Parameter Availability Error"End Sub 
Share the Post:
Share on facebook
Share on twitter
Share on linkedin


The Latest

chrome os developer mode

How to Turn on Chrome OS Developer Mode

Google’s Chrome OS is a popular operating system that is widely used on Chromebooks and other devices. While it is designed to be simple and user-friendly, there are times when users may want to access additional features and functionality. One way to do this is by turning on Chrome OS

homes in the real estate industry

Exploring the Latest Tech Trends Impacting the Real Estate Industry

The real estate industry is changing thanks to the newest technological advancements. These new developments — from blockchain and AI to virtual reality and 3D printing — are poised to change how we buy and sell homes. Real estate brokers, buyers, sellers, wholesale real estate professionals, fix and flippers, and beyond may

man on floor with data

DevX Quick Guide to Data Ingestion

One of the biggest trends of the 21st century is the massive surge in internet usage. With major innovations such as smart technology, social media, and online shopping sites, the internet has become an essential part of everyday life for a large portion of the population. Due to this internet