if rs.eof = true then response.write "eof is true" if rs.eof = false then response.write "eof is false"
發(fā)現(xiàn)輸出竟然是eof is true eof is false, 說(shuō)明無(wú)法判斷rs.eof的值,為何如此百思不得其解。檢查數(shù)據(jù)庫(kù),發(fā)現(xiàn)庫(kù)中并沒(méi)有mytable表, 如果該表不存在,rs.open "select * from mytable", conn 就會(huì)出錯(cuò),為何沒(méi)有出錯(cuò),很有可能捕獲的異常被忽略了。 檢查包含文件conn.asp, 發(fā)現(xiàn)了異常處理代碼:
on error resume next
原來(lái)問(wèn)題在此。
on error resume next忽略了查詢表時(shí)的失敗以及后續(xù)的錯(cuò)誤,造成進(jìn)入死循環(huán)。 那為何網(wǎng)站本來(lái)運(yùn)行正常,現(xiàn)在卻找不到mytable表了呢?仔細(xì)檢查網(wǎng)站才發(fā)現(xiàn)“有‘客'自遠(yuǎn)方來(lái)”,上傳了后門工具、刪除了多張數(shù)據(jù)表,害我忙活了一天。