欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費電子書(shū)等14項超值服

開(kāi)通VIP
如何從 ASP 調用 SQL Server 存儲過(guò)程

如何從 ASP 調用 SQL Server 存儲過(guò)程

概要

null
有關(guān)本文的 Microsoft Visual Basic .NET 版本,請參閱 306574 (http://support.microsoft.com/kb/306574/)。
本文演示了使用 ActiveX 數據對象 (ADO) 從 Active Server Pages 調用存儲過(guò)程的三種方法。

更多信息

null
下面的示例使用 Command 對象調用示例存儲過(guò)程 sp_test。此存儲過(guò)程接受整數,同時(shí)返回一個(gè)整數值:


<%@ LANGUAGE="VBSCRIPT" %><!--#include virtual="/ASPSAMP/SAMPLES/ADOVBS.INC"--><HTML><HEAD><TITLE>Place Document Title Here</TITLE></HEAD><BODY>This first method queries the data source about the parametersof the stored procedure. This is the least efficient method of callinga stored procedure.<BR><%Set cn = Server.CreateObject("ADODB.Connection")Set cmd = Server.CreateObject("ADODB.Command")cn.Open "data source name", "userid", "password"Set cmd.ActiveConnection = cncmd.CommandText = "sp_test"cmd.CommandType = adCmdStoredProc‘ Ask the server about the parameters for the stored proccmd.Parameters.Refresh‘ Assign a value to the 2nd parameter.‘ Index of 0 represents first parameter.cmd.Parameters(1) = 11cmd.Execute%>Calling via method 1<BR>ReturnValue = <% Response.Write cmd.Parameters(0) %><P><!-- ************************************************************ -->Method 2 declares the stored procedure, and then explicitly declaresthe parameters.<BR><%Set cn = Server.CreateObject("ADODB.Connection")cn.Open "data source name", "userid", "password"Set cmd = Server.CreateObject("ADODB.Command")Set cmd.ActiveConnection = cncmd.CommandText = "sp_test"cmd.CommandType = adCmdStoredProccmd.Parameters.Append cmd.CreateParameter("RetVal", adInteger, _adParamReturnValue)cmd.Parameters.Append cmd.CreateParameter("Param1", adInteger, _adParamInput)‘ Set value of Param1 of the default collection to 22cmd("Param1") = 22cmd.Execute%>Calling via method 2<BR>ReturnValue = <% Response.Write cmd(0) %><P><!-- ************************************************************ -->Method 3 is probably the most formal way of calling a stored procedure.It uses the canocial<%Set cn = Server.CreateObject("ADODB.Connection")cn.Open "data source name", "userid", "password"Set cmd = Server.CreateObject("ADODB.Command")Set cmd.ActiveConnection = cn‘ Define the stored procedure‘s inputs and outputs‘ Question marks act as placeholders for each parameter for the‘ stored procedurecmd.CommandText = "{?=call sp_test(?)}"‘ specify parameter info 1 by 1 in the order of the question marks‘ specified when we defined the stored procedurecmd.Parameters.Append cmd.CreateParameter("RetVal", adInteger, _adParamReturnValue)cmd.Parameters.Append cmd.CreateParameter("Param1", adInteger, _adParamInput)cmd.Parameters("Param1") = 33cmd.Execute%>Calling via method 3<BR>ReturnValue = <% Response.Write cmd("RetVal") %><P></BODY></HTML>
請注意,上面的示例使用了訪(fǎng)問(wèn) Command 對象的 Parameters 集合的各種方法。有些方法使用 Command 對象的默認集合,
而其他方法指定了要訪(fǎng)問(wèn)的特定集合的屬性。



這篇文章中的信息適用于:
Microsoft Active Server Pages 4.0
Microsoft ActiveX Data Objects 2.0
Microsoft ActiveX Data Objects 2.7
Microsoft ActiveX Data Objects 2.7
Microsoft ActiveX Data Objects 2.5
Microsoft ActiveX Data Objects 2.6
Microsoft ActiveX Data Objects 2.7
本站僅提供存儲服務(wù),所有內容均由用戶(hù)發(fā)布,如發(fā)現有害或侵權內容,請點(diǎn)擊舉報。
打開(kāi)APP,閱讀全文并永久保存 查看更多類(lèi)似文章
猜你喜歡
類(lèi)似文章
ASP+存儲過(guò)程(轉載)
Asp深度揭密(上)
在A(yíng)SP頁(yè)面進(jìn)行參數化查新一例
[收藏]Asp 與access數據庫連接及基本操作
asp代碼實(shí)現EXCEL數據導入到SQL數據庫
ASP與SQL Server存儲過(guò)程
更多類(lèi)似文章 >>
生活服務(wù)
分享 收藏 導長(cháng)圖 關(guān)注 下載文章
綁定賬號成功
后續可登錄賬號暢享VIP特權!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服

欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久