Article ID: 165156 - Last Review: May 2, 2006 - Revision: 4.1 How To Determine Parameter Requirements for a Stored Procedure in ASP
This article was previously published under Q165156 SUMMARY
This article provides the ASP code necessary to programmatically determine
the parameter requirements for any stored procedure. The sample code
provided determines the parameter name, data type, direction, and size of
all parameters in a stored procedure. The developer can use this acquired
information at design time in defining the stored procedure call. The
method outlined in this article uses the "Parameters.Refresh" method and
the "Parameters" collection and is useful for those developers who do not
have access to other tools used for obtaining stored procedure information.
MORE INFORMATION
Determining how to properly call a stored procedure can be tricky if you
are unaware of the stored procedure's parameter information. Without the
correct information, you cannot properly create the ADO parameters.
The following ASP sample determines any stored procedure's parameter information. In this example we determine the parameter information for parameters in a stored procedure named "sp_MyStoredProc" and place them in an HTML table on the screen. NOTE: The values reported are numerical. The corresponding constants may be found in the Adovbs.inc file. This file is installed during Active Server Pages setup, and placed in the \aspsamp\samples directory. This directory is normally located in your \inetpub directory. It is recommended programming practice to use the constants versus the numerical values when calling your stored procedure. This makes your code easier to read and maintain. PARAMETER NAME DATA-TYPE DIRECTION DATA-SIZE Return_Value 3 4 0 param1 129 1 30 With this information you can change the code to read: REFERENCES
For the latest Knowledge Base articles and other support information on
Visual InterDev and Active Server Pages, see the following page on the
Microsoft Technical Support site:
http://support.microsoft.com/search/default.aspx?qu=vinterdev
(http://support.microsoft.com/search/default.aspx?qu=vinterdev)
APPLIES TO
| Other Resources Other Support Sites
CommunityGet Help NowArticle Translations |






Windows Live
Facebook
Twitter
Linkedin
Digg it
Yahoo
Delicious
StumbleUpon
Yammer
Reddit
Technorati
FriendFeed
Email
Back to the top
