5.htm
<html>
<form name="form1" method="post" action="5.asp">
name <input type="text" name="name"><br>
tel <input type="text" name="tel"><br>
message <input type="text" name="message" value=""><br>
<input type="submit" name="Submit" value="提交">
<input type="reset" name="Submit2" value="重置">
</form>
</html>
5.asp
<%
set conn=server.createobject("adodb.connection")
conn.open "driver={microsoft access driver (*.mdb)};dbq="&server.mappath("../database/guestbook.mdb")
name=request.form("name")
tel=request.form("tel")
message=request.form("message")
exec="insert into guest(name,tel,message)values('"+name+"',"+tel+",'"+message+"')"
conn.execute exec
conn.close
set conn=nothing
response.write "记录添加成功!"
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
结果遇到问题:
错误类型:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Microsoft Access Driver] 操作必须使用一个可更新的查询。
/练习/表单练习/5.asp, 第 8 行