基本上都是你在keyin的時候拼錯字,或者是引號使用不當..
將原始碼修改如下:
saveadd.asp:
<%
Set Conn = Server.CreateObject("ADODB.Connection")
DBpath = Server.MapPath("gbook.mdb")
Conn.open "Driver={Microsoft Access Driver (*.mdb)};dbq=" & DBPath
set rs = server.createobject("adodb.recordset")
SortSql = "Select * From guestbook order by fldID DESC"
rs.Open SortSql,conn,1,3
if request.form("subject") <> "" and request.form("message") <> "" then
rs.addnew
rs("name") = request.form("name")
rs("message") = request.form("message")
rs("PostTime") = now()
rs.update
end if
rs.close
conn.close
response.redirect "gbook.asp"
%>
Gbook.asp:
留言版<%
set conn=server.createobject("adodb.connection")
DBPath=Server.MapPath("gbook.mdb")
Conn.open "Driver={Microsoft Access Driver (*.mdb)};dbq=" & DBPath
set rs=server.createobject("adodb.recordset")
SortSql="Select * From guestbook order by fldID DESC"
rs.Open SortSql,conn,1,1
%>
留言版
我有話想說 回首頁 TOP
<%
do while not RS.EOF
response.write "
"
response.write "留言者:"& RS("name")& "留言時間" & RS("PostTime") & " | "
response.write "
主題:"& RS("subject") & " | "
response.write "
內容:"& RS("message") & " | "
rs.MoveNext
loop
%>
<%
rs.close
conn.close
%>
ⓘ
此內容最初發佈在 Y! Answers 上,這是一個於 2021 年關閉的問答網站
Loading...