Some examples of the storage process being invoked in ASP. (1)

Source: Internet
Author: User
Tags odbc connection
Return Values How-to Execute a Stored Proc ' s
This demo It's called Returnvalue.asp and shows to execute a stored procedure the has input params, output params , a returned recordset and a return value.
<!--Author:john Bailey-->
<%@ Language=vbscript%>
<%
' CODE to CREATE ' The STORED PROCEDURE so this ASP accesses
' Just Remove all comments on this line, paste into the SQL Query Analyzer and run.
'--Insures the right database
' Use pubs
' Go
'
'--Creates the procedure
' CREATE PROCEDURE Sp_pubstest
'
'--Declare three parameter variables
' @au_lname varchar (20),
' @intID int,
' @intIDOut int OUTPUT
'
' As
'
' SELECT @intIDOut = @intID + 1
'
' SELECT *
' From authors
' WHERE au_lname like @au_lname + '% '
' Return @intID + 2
%>
<%
' This is the ASP CODE. Just run from the server.
Option Explicit
Dim CMDSP
Dim adors
Dim Adcmdspstoredproc
Dim adParamReturnValue
Dim adParamInput
Dim adParamOutput
Dim Adinteger
Dim ival
Dim OVal
Dim Adofield
Dim adVarChar
Adcmdspstoredproc = 4
adParamReturnValue = 4
adParamInput = 1
adParamOutput = 2
Adinteger = 3
adVarChar = 200
Ival = 5
OVal = 3
'--Create a Command object--
Set cmdsp = Server.CreateObject ("Adodb.command")
'--Make a ODBC connection to the (local) SQL Server,
'--Connecting to the "Pubs database with the default SA login and empty password
Cmdsp.activeconnection = "Driver={sql server};server= (local); Uid=sa; pwd=;D Atabase=pubs "

'--Define the name of the command
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.