前辈们近来帮看下,谢谢 !

gs925229 2006-12-24 05:15:19
这个是第一个文件. index.asp
为什么我点添加就是保存,那个联系人的内容也获取不到.等,大虾们帮看下,谢谢了!
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="conn.asp" -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>留言版</title>
</head>

<body topmargin="0">
<table cellpadding="0" cellspacing="0" border="1" width="960" height="550" align="center" background="image/dp.jpg">
<form action="add.asp" method="post" name=form1>
<tr>
<td width="150"> </td>
<td width=660" align="center">
<table width="660" height="61%" border="0" align="center" >


<tr><td height="20"> </td>
</tr>

<tr><td height="50"><div align="center"><font size="6" color="#FF0000">留言版</font></div></td>
</tr>
<tr><td height="250"><table width="100%" height="100%" border="1">

<tr >
<td height="25" ><font size="4" color="#000000">标题</font></td>
<td height="25"><div align="left">
<input name="text" type="text" size="25" />
</div></td>
</tr>
<tr>
<td height="25"><font size="4" color="#000000">联系人</font></td>
<td><div align="left">
<input name="lianxi" type="lianxi" id="lianxi" size="25"/>
</div></td>
</tr>
<tr>
<td height="100"><font size="4" color="#000000">内容</font></td>
<td><div align="left">
<textarea name="body" cols="40" type="body" rows="10"></textarea>
</div></td>
</tr>
<tr><td> </td><td >      
<div align="left">
<input type="submit" name="submit" value="确 定">
</div></td></tr>

</table></td>
</tr>
<hr>
<tr><td height="200"><table width="100%" height="100%">
<%
sql="select * from mail order by ID desc"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
%>
<% if rs.eof then
Response.Write"没有留言!"
else
%>
<% do while not rs.eof %>
<tr>
<td><%=rs.title%></td>
</tr>
<tr>
<td><%=rs.name%></td>
</tr>
<tr>
<td><%=rs.body%></td>
</tr>
<tr><td><%=rs.data%></td>
</tr>
<% rs.movenext
loop
%>
<% end if %>
<% rs.close
set rs=nothing
%></table></td>
</tr>
</table>
</td>
<td width="150"> </td></tr>
</tr>
</form>
</table>



</body>
</html>

添加文件是 add.asp

<%
dim conn,sql,con
set conn=server.CreateObject("adodb.connection")
con="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & server.MapPath("db.mdb")
conn.Open con
dim text,body,lianxi,data_up
text=request.Form("text")
body=request.Form("body")
lianxi=request.Form("lianxi")
data_up=now()
sql="insert into mail(text,body,[lianxi],data_up) values('"&text&"','"&body&"','"&lianxi&"','"&data&"')"
response.write (sql)
conn.execute(sql)
Response.Write"<script language='javascript'>alert('添加成功!')</script>"
'response.redirect "index.asp"

%>

...全文
163 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
haiwei323 2006-12-25
  • 打赏
  • 举报
回复
input类型写错了!
lingyu1983 2006-12-25
  • 打赏
  • 举报
回复
<input name="lianxi" type="text" id="lianxi" size="25"/>
这样改了就应该没问题了
lingyu1983 2006-12-25
  • 打赏
  • 举报
回复
<input name="lianxi" type="txt" id="lianxi" size="25"/>
这样改了就应该没问题了
gs925229 2006-12-25
  • 打赏
  • 举报
回复
他现在说 错误类型:
Microsoft JET Database Engine (0x80040E14)
INSERT INTO 语句的语法错误。
/010/add.asp, 第 15 行
gggmmtddir 2006-12-24
  • 打赏
  • 举报
回复
<input name="lianxi" type="lianxi" id="lianxi" size="25"/>
看下你的type="lianxi" 这是什么意思?改为 type="text"
atmo 2006-12-24
  • 打赏
  • 举报
回复
sql="insert into mail(text,body,lianxi,data_up) values('"&text&"','"&body&"','"&lianxi&"','"&data&"')"

试试

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧