Operation is not allowed when the object is closed (Object is not closed)

后端 未结 2 1555
北海茫月
北海茫月 2020-12-22 06:35

The following code, is generating that error.

Set getList = Server.CreateObject(\"ADODB.Command\")
getList.ActiveConnection=EV_WikiConn
getList.Prepared = tr         


        
2条回答
  •  一整个雨季
    2020-12-22 07:11

    OK, got it all figured out. below is the code that was used, with a few notes in the code, to show what I did to make it 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 into @Lookup(SongTitle)select * from " & _
        "( values ('Hotter_Than_Hell'), ('Firehouse'), ('She'), " & _
        "('Parasite'), ('Nothin''_To_Lose')) as x(a) " & _
        "select A.AlbumName, S.SongTitle , S.Writers , S.Vocals , " & _
        "S.SID , S.TheTime from Albums A inner join " & _
        "Songs S on A.AID = S.AID inner join " & _
        "@Lookup L on L.SongTitle = S.SongTitle order by L.Id"
    
    ' the SET NOCOUNT ON, was added, but did not resolve the issue, I just left it in.
    ' The next 3 lines is what fixed the issue.
    While rsList.State <> adStateOpen
        Set rsList = rsList.NextRecordset
    Wend
    While Not rsList.EOF%>
    
    <%=rsList("SongTitle")%>
    
    <%rsList.movenext
    wend
    rsList.Close
    set rsList = nothing
    

提交回复
热议问题