在线求助:为啥添加不进数据库呢?语法没错误。。
下面是添加界面的代码:addtext.asp <!--#include file="conn.asp"-->
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=gb2312" />
<title>添加文章</title>
</head>
<script language="javascript" type="text/javascript">
function check()
{
if (document.add.addtitle.value==0)
{
alert("请输入文章标题!");
document.add.addtitle.focus();
return false;
}
if (document.add.addcontent.value==0)
{
alert("请输入文章内容!");
document.add.addcontent.focus();
return false;
}
}
function dialog()
{
//Response.Write(
q=window.confirm("确定取消编辑?")
if(q==true)
{
window.close()
return false
}
}
</script>
<body>
<table bgcolor="#CCFFFF">
<tr>
<td height="50" width="800" align="center" valign="top"> <font size="+2" color="#0000FF">添加文章</font>
</td>
</tr>
</table>
<table height="500" width="800" bgcolor="#CCFFFF" cellpadding="30" >
<td valign="top">
<form name="add" action="addtexttodb.asp" method="post">
<p>文章标题:<input type="text" name="addtitle" value=""/></p>
<%
sql="select * from perinfo where id="&request("id")&""
set rs=server.createobject("ADODB.recordset")
rs.open sql,conn,1,1
if not rs.eof then
%>
<p>作 者:<input type="text" name="addauthor" value="<%=rs("name")%>" /></p>
<%
end if
%>
<p>文章内容:</p>
<p><textarea name="addcontent" rows="20" cols="60"/></textarea>
</p>
<p align="left"><input type="submit" name="submit" value="提交"/>
<input type="button" name="cancle" value="取消" />
</form>
</td>
</table>
</body>
</html>
连接数据库代码如下:addtexttosql.asp
<!--#include file="conn.asp"-->
<%
title=Request.Form("addtitle")
author=Request.Form("addauthor")
content=Request.Form("addcontent")
sql="select * from [text] where id ="& request("id")&""
set rs=server.createobject("ADODB.recordset")
rs.open sql,conn,1,3
rs.AddNew
//rs("title")=title
//rs("content")=content
//rs("author")=author
rs("id")=request("id")
rs.Update
rs.Close
set rs=nothing
conn.Close
set conn=nothing
Response.Write "<script language='javascript' type='text/javascript'>"& chr(13)
Response.Write "alert('添加文章成功!');"& chr(13)
Response.Write "window.document.location.href='index.asp';"& chr(13)
Response.Write "</script>"& chr(13)
Response.End
%>
运行没有错误,但是运行结束,数据库表中并没有添加进数据,这是为什么啊?