【发布时间】:2011-04-24 01:08:24
【问题描述】:
我的存储过程非常简单。它插入一条新记录。在它的末尾,我有以下行:
SELECT SCOPE_IDENTITY()
1) 我是否使用正确的代码来返回新插入记录的主键值?
2) 如何使用 ASP Classic/VBScript 和 ADO Classic 检索此值?
Dim cmdUA
Set cmdUA = Server.CreateObject("ADODB.Command")
Set cmdUA.ActiveConnection = tcon
cmdUA.CommandText = "InsertUserAgent"
cmdUA.CommandType = adCmdStoredProc
cmdUA.Parameters.Append cmdUA.CreateParameter("useragent", adVarWChar, _
adParamInput, 1000)
cmdUA("useragent") = Request.ServerVariables("HTTP_USER_AGENT")
cmdUA.Exec
'Here I need to get the value returned from the stored procedure
Set cmdUA.ActiveConnection = Nothing
Set cmdUA = Nothing
【问题讨论】:
标签: sql-server vbscript asp-classic ado