不用COMMAND對象來調用預存程序的ASP代碼

來源:互聯網
上載者:User
command|command對象|預存程序 他說如果返回多個值,比如紀錄集以及傳回值一定要用COMMAND對象。。我現在終於搞定了。。:)

<%@ Language=VBScript %>
<%
'一段測試不用COMMAND對象來調用預存程序的ASP代碼 作者:大自然 信箱:zhanmr@telekbird.com.cn 首頁:http://zhanzhen.wayall.com
'----------------------------------------------------------------------------------------------------
'CREATE PROCEDURE TopNewsSP
' @intTopRow Int,
' @vcInputMsg Varchar(20),
' @vcReturnMsg Varchar(20) OUTPUT
'AS
' SET ROWCOUNT @intTopRow
' SELECT id,標題,發布日期,關鍵字 FROM news WHERE 關鍵字 ='公告通知' ORDER BY 發布日期 DESC,Id DESC
' SELECT id,標題,發布日期,關鍵字 FROM news WHERE 關鍵字 ='娛樂新聞' ORDER BY 發布日期 DESC,Id DESC
' IF @vcInputMsg = '男'
' SELECT @vcReturnMsg = '男人'
' ELSE
' SELECT @vcReturnMsg = '女人'
'----------------------------------------------------------------------------------------------------

Option Explicit
Dim Conn, Rs, RsCount, SqlQuery

Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "itrd", "sa"
SqlQuery = "DECLARE @returnmsg varchar(20)" & VbCrLf & "EXEC TopNewsSP 5, '男', @returnmsg OUTPUT" & VbCrLf & "SELECT @returnmsg"
Set Rs = Conn.Execute(SqlQuery)
RsCount = 1

Do Until Rs Is Nothing
Rs.MoveFirst
While Not Rs.Eof
Response.Write Rs(0)
Rs.MoveNext
Wend
Response.Write "第" & RsCount & "個RS對象<br>"
RsCount = RsCount + 1
Set Rs = Rs.NextRecordSet
Loop

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



相關文章

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。