以下代碼正在生成該錯誤。對象關閉時不允許操作(對象未關閉)
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 into @Lookup(SongTitle)select * from (values ('Deuce')) 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"
set rsList = getList.execute
while not rsList.eof ' Error is on this line 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 into @Lookup(SongTitle)select * from (values ('Deuce'),('Strutter'),('Parasite')) 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"
set rsList = getList.execute
If rsList.State <> adStateOpen Then
While rsList.State <> adStateOpen
Set rsList = rsList.NextRecordset
rsList.movenext
wend
end if
這段代碼這使得運行,但是,我只得到一個記錄,而不是10就是在實際的形式。所以,這是行不通的,但想顯示我迄今爲止所嘗試的。
請添加您獲取一條記錄的代碼,'while not rsList.eof'循環中的部分 – SearchAndResQ
兩個代碼現在都有。最底層的代碼是隻給出一條記錄的代碼,即使在這個例子中有3個應該顯示。 –
加入歌曲標題永遠不會是一個好主意,如果標題被調整會發生什麼?在可能的情況下使用ID來形成獨特的關係,文本的從不是一個好主意。 「歌曲」表格是否沒有針對您可以使用的每首歌曲的唯一ID而不是「SongTitle」? – Lankymart