最初我的问题是我的帖子重复了。我相信这是因为我没有在 SQL 语句中链接我的表。现在我已经完成了,我在 if info.eof 语句之后打印了“未找到数据”。
我确信数据库中有我手动检查的信息,但是没有成功。
这是我的代码:
<% option explicit %>
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="normalize.css">
</head>
<body>
<!--#include file="header.asp"-->
<!--#include file="dbconn.asp"-->
<%
dim sql, info
' 0 1 2 3 4 5
SQL = "select projectName, UserName, Category, Created, url, Projectstable.description "&_
"from ProjectsTable, PictureTable, Usertable, CategoryTable "&_
"where Projectstable.ID=PictureTable.projectNum AND "&_
"categoryNum=CategoryTable.ID AND "&_
"ProjectsTable.userNum=Usertable.ID AND "&_
"UserTable.ID=PictureTable.userNum "&_
"order by Created"
set info=conn.execute(SQL)
if info.eof then
response.write "<p>No Data Found</p>"
else
do
response.write "<h1>" & info(0) & "</h1> By: " & info(1) & " Posted in: " & info(2) & " Created on: " & info(3) & "<br>" &_
"<img src=""images/" &info(4)&""">" &_
"<p>" & info(5) & "</p>"
info.movenext
loop until info.eof
end if
conn.close
%>
</body>
</html>