标题:急! 记录添加无内容显示???
取消只看楼主
jm117
Rank: 1
等 级:新手上路
帖 子:62
专家分:0
注 册:2007-6-23
结帖率:0
 问题点数:0 回复次数:1 
急! 记录添加无内容显示???
我编写了如下代码,希望向数据库中添加四个字段的记录,但是添加后只能看到数据库中记录号增加,看不到任何记录内容??请高手赐教!
代码如下:
<table width="217" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#0099FF">
<tr>
<td width="213" height="155"><form name="form1" method="post" action="">
<label>姓名:
<input name="name" type="text" id="name">
</label>
</form>
<span class="STYLE1"></span>
<form name="form2" method="post" action="index.asp"">
<label>性别:
<input name="sex" type="text" id="sex">
</label>
</form>
<form name="form3" method="post" action="">
<label>年龄:
<input name="age" type="text" id="age">
</label>
</form>
<form name="form4" method="post" action="">
<label>籍贯:
<input name="where" type="text" id="where">
</label>
</form>
<form name="form5" method="post" action="">
<label>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input name="Submit1" type="submit" id="Submit1" value="提交">
</label>
<label>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input name="Submit2" type="reset" id="Submit2" value="重置">
</label>
</form>
</td>
</tr>
</table>
<!--#include file="conn.asp"-->
<%
dim sql,name,sex,age,where
set rs=server.createobject("adodb.recordset")
sql="select * from message"
rs.open sql,conn,1,3
rs.addnew
rs("name")=request.Form("name")
rs("sex")=request.Form("sex")
rs("age")=request.Form("age")
rs("where")=request.Form("where")
rs.update
rs.close
conn.close
set rs=nothing
set conn=nothing
response.write("记录添加成功")
%>
蓝色代码为设计表单代码,红色为ASP记录添加代码,其中message为表的名称
搜索更多相关主题的帖子: 记录 
2007-07-01 19:53
jm117
Rank: 1
等 级:新手上路
帖 子:62
专家分:0
注 册:2007-6-23
得分:0 
问题得以解决,谢谢!

2007-07-10 23:43



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-151850-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.437425 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved