To invoke the ASP code of a stored procedure without a Command object

Source: Internet
Author: User
Tags date
Command|command Object | Stored procedure He said that if you return multiple values, such as the recordset and the return value, you must use the Command object ... I'm finally done with it. :)

<%@ Language=vbscript%>
<%
' A section of the test does not use the Command object to invoke the stored procedure's ASP code author: Nature Mail: zhanmr@telekbird.com.cn Home: http://zhanzhen.wayall.com
'----------------------------------------------------------------------------------------------------
' CREATE PROCEDURE TOPNEWSSP
' @intTopRow Int,
' @vcInputMsg Varchar (20),
' @vcReturnMsg Varchar (OUTPUT)
' As
' SET rowcount @intTopRow
' SELECT ID, title, release date, keyword from news WHERE keyword = ' announcement notice ' ORDER by release date Desc,id DESC
' SELECT ID, title, release date, keyword from news WHERE keyword = ' entertainment news ' ORDER by release date Desc,id DESC
' IF @vcInputMsg = ' Male '
' SELECT @vcReturnMsg = ' man '
' ELSE
' SELECT @vcReturnMsg = ' woman '
'----------------------------------------------------------------------------------------------------

Option Explicit
Dim Conn, Rs, Rscount, sqlquery

Set Conn = Server.CreateObject ("ADODB. Connection ")
Conn.Open "ITRD", "sa"
SQLQuery = "DECLARE @returnmsg varchar" & VbCrLf & "EXEC topnewssp 5, ' Male ', @returnmsg OUTPUT" & VbCrLf &am P "Select @returnmsg"
Set Rs = Conn.execute (sqlquery)
Rscount = 1

Do Until Rs are nothing
Rs.movefirst
While not rs.eof
Response.Write Rs (0)
Rs.movenext
Wend
Response.Write "" & Rscount & "RS Object <br>"
Rscount = Rscount + 1
Set Rs = Rs.nextrecordset
Loop

Set Rs = Nothing
Conn.close
Set Conn = Nothing
%>



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.