新聞中心
這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
ASP調(diào)用SQL Server存儲過程的實際操作步驟
以下的文章主要描述的是ASP調(diào)用SQL Server存儲過程的實際操作步驟,如果你對ASP調(diào)用SQL Server存儲過程的實際操作步驟心存好奇的話,你就可以對以下的文章點擊觀看了,望大家在瀏覽之后會對其有更深的了解。

調(diào)用代碼:
程序代碼
- dim account,oldname,newname,RsCommand
- dim adCmdStoredProc,adInteger,adChar,adParamInput,adParamOutput,ReturnValue
- account = session("whoami")
- oldname = trim(Request.Form("oldname"))
- newname = trim(Request.Form("newname"))
- adCmdStoredProc = 4
- adInteger = 3
- adChar = 129
- adParamInput = 1
- adParamOutput = 2
'建立COMMAND對象
- set RsCommand = Server.CreateObject("adodb.command")
- RsCommand.CommandText = "sp_addModify13SName"
- RsCommand.ActiveConnection = conn
- RsCommand.CommandType = adCmdStoredProc
'添加參數(shù)
- RsCommand.Parameters.Append RsCommand.CreateParameter("@account", adChar, adParamInput,20,account)
- RsCommand.Parameters.Append RsCommand.CreateParameter("@oldname", adChar, adParamInput,20,oldname)
- RsCommand.Parameters.Append RsCommand.CreateParameter("@newname", adChar, adParamInput,20,newname)
- RsCommand.Parameters.Append RsCommand.CreateParameter("@ReturnValue",adInteger, adParamOutput,4)
- RsCommand.execute'執(zhí)行
- ReturnValue = RsCommand.Parameters("@ReturnValue")'取出返回值
SQL Server存儲過程代碼:
程序代碼
- Create proc sp_addstorename
- ( @account char(20),
- @oldname char(20),
- @newname char(20),
- @ReturnValue int
- )
返回1正常
返回0插入失敗
返回9系統(tǒng)錯誤
- as
- Begin
- set @ReturnValue = 0
- insert into modifyname13(account,oldname,newname) values(@account,@oldname,@newname)
- if @@error > 0
- Begin
- rollback
- set @ReturnValue = 9
- End
- else
- set @ReturnValue = 1
- End
以上的相關(guān)內(nèi)容就是對ASP調(diào)用SQL Server存儲過程的介紹,望你能有所收獲。
【編輯推薦】
- SQL Server浮點數(shù)據(jù)類型的詳細解析
- 卸載SQL Server 2005組件的正確順序
- SQL Server使用檢查約束來驗證數(shù)據(jù)實戰(zhàn)演示
- SQL Server存儲過程的命名標(biāo)準(zhǔn)如何進行?
- SQL Server數(shù)據(jù)庫的臨時表的正確操作步驟
分享名稱:ASP調(diào)用SQL Server存儲過程的實際操作步驟
網(wǎng)頁URL:http://www.5511xx.com/article/dpsccde.html


咨詢
建站咨詢
