我有以下代码:
strSQL = "SELECT COUNT(*) AS anz FROM tbl_ergebnisse WHERE testavg >0"
set rs3 = Conn.Execute(strSQL)
Response.Write "Count(*): <br>"
if not rs3.eof then
Response.Write "Anz: " & rs3("anz")
else
Response.Write "EOF"
end if
strSQL = "SELECT testavg FROM tbl_ergebnisse WHERE testavg >0"
set rs2 = Conn.Execute(strSQL)
Response.Write "Entries: <br>"
do while not rs2.eof
Response.Write rs2("testavg") & "<br>"
rs2.MoveNext()
loop
strSQL = "SELECT AVG(testavg) AS mittelwert FROM tbl_ergebnisse WHERE testavg >0"
set rs = Conn.Execute(strSQL)
if not rs.eof then
Response.Write "Mittelwert: " & rs("mittelwert")
else
Response.Write "EOF"
end if
这给了我一个奇怪的结果:查询 1 返回“4”(计数正确)。查询 2 没有返回结果,查询 3 也没有返回结果
表“tbl_ergebnisse”看起来像这样
testavg (DECIMAL)
条目:3;3;4;5个;
可以在此处找到表格中数据的屏幕截图:www.trinews.at/data.png
有什么建议为什么我得到一个空的记录集?直接在数据库上运行查询会返回正确的值。