【发布时间】:2014-04-03 17:13:43
【问题描述】:
我必须为经典的 asp 做一个快速而肮脏的 sql 会话存储,所以我有以下存储过程来完成插入工作。当我从 sql management studio 或通过 asp 代码运行它时,它插入得很好,但它没有返回 scope_identity。奇怪的是,当我从代码执行该过程时,我在检查 rs.eof 的行上收到“对象关闭时不允许操作”错误消息。
create procedure InsertSessionValue
@keyname varchar(50),
@value varchar(max)
as
declare @ID int
delete from storedsessionsimple where datesaved < dateadd(d, -1, getdate())
insert into dbo.StoredSessionSimple (SessionKey, SessionValue, DateSaved) values (@keyname, @value, getdate())
set @ID = SCOPE_IDENTITY()
return @ID
而asp代码是……
set cnLocal = GetConnection()
cnLocal.open()
set rs = cnLocal.execute("exec InsertSessionValue '" & SessionKey & "','" & SessionValue & "'")
if not rs.eof then
id = rs(0)
end if
rs.close: set rs = nothing
end if
cnLocal.close: set cnLocal = nothing
【问题讨论】:
标签: asp-classic vbscript ado