新手问题 关于ASP留言板

来源:百度知道 编辑:UC知道 时间:2024/05/17 02:22:17
我用ASP写了个简单得留言板
INDEX.ASP文件代码如下
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>

<body bgcolor="#FF9933">
<table width="90%" height="500" border="1" align="center">
<tr>
<td height="400" align="left" valign="top" bgcolor="#FFFFFF">
<p> </p>
<table width="95%" height="206" border="1" align="center">
<tr>
<td bgcolor="#FF9933"> </td>
</tr>
</table>
<p> </p>
<table width="95%" height="210"

我给你找出了2个问题
1、qq=request.form("qq) 少了一个引号
2、exec="insert into books(name,qq,email,text)values("+name+","+qq+","+email+","+text+")"
这句应该改为:exec="insert into books(name,qq,email,text) values('"+name+"','"+qq+"','"+email+"','"+text+"')"

整个代码liuyan.asp应该是
<%
set conn=server.createobject("adodb.connection")
conn.open "driver={microsoft access driver (*.mdb)};dbq="&server.mappath("#date1.mdb")
name=request.form("name")
qq=request.form("qq")
email=request.form("email")
text=request.form("text")
exec="insert into books(name,qq,email,text) values('"+name+"','"+qq+"','"+email+"','"+text+"')"
conn.execute exec
conn.close