vbscript - Operation is not allowed when the object is closed (Object is not closed) -
the following code, generating error.
set getlist = server.createobject("adodb.command") getlist.activeconnection=ev_wikiconn getlist.prepared = true getlist.commandtext= "declare @lookup table(id int identity(1, 1) , songtitle nvarchar(512) ) insert @lookup(songtitle)select * ( values ('deuce')) x(a) select a.albumname, s.songtitle , s.writers , s.vocals , s.sid , s.thetime albums inner join songs s on a.aid = s.aid inner join @lookup l on l.songtitle = s.songtitle order l.id" set rslist = getlist.execute while not rslist.eof ' error on line here.
i added code here
set getlist = server.createobject("adodb.command") getlist.activeconnection=ev_wikiconn getlist.prepared = true getlist.commandtext= "declare @lookup table(id int identity(1, 1) , songtitle nvarchar(512) ) insert @lookup(songtitle)select * ( values ('deuce'),('strutter'),('parasite')) x(a) select a.albumname, s.songtitle , s.writers , s.vocals , s.sid , s.thetime albums inner join songs s on a.aid = s.aid inner join @lookup l on l.songtitle = s.songtitle order l.id" set rslist = getlist.execute if rslist.state <> adstateopen while rslist.state <> adstateopen set rslist = rslist.nextrecordset rslist.movenext wend end if
this makes run, however, 1 record, instead of 10 in actual form. so, not going work, wanted show have tried far.
ok, got figured out. below code used, few notes in code, show did make work.
set getlist = server.createobject("adodb.command") getlist.activeconnection=ev_wikiconn getlist.prepared = true getlist.commandtext = _ "set nocount on " & _ "declare @lookup table(id int identity(1, 1) , " & _ "songtitle nvarchar(512) ) " & _ "insert @lookup(songtitle)select * " & _ "( values ('hotter_than_hell'), ('firehouse'), ('she'), " & _ "('parasite'), ('nothin''_to_lose')) x(a) " & _ "select a.albumname, s.songtitle , s.writers , s.vocals , " & _ "s.sid , s.thetime albums inner join " & _ "songs s on a.aid = s.aid inner join " & _ "@lookup l on l.songtitle = s.songtitle order l.id" ' set nocount on, added, did not resolve issue, left in. ' next 3 lines fixed issue. while rslist.state <> adstateopen set rslist = rslist.nextrecordset wend while not rslist.eof%> <%=rslist("songtitle")%> <%rslist.movenext wend rslist.close set rslist = nothing
Comments
Post a Comment