我的数据库中有表lovebook,有四个字段id,fromname,lovename,tomai
有如下两个程序:
love.asp如下
<form action="lovepost.asp" method=post>
<tr>
<td><p>您的姓名:
<input type="text" name="fromname">
<br>
她的姓名:
<input type="text" name="lovename">
<br>
您的信箱:
<input type="text" name="tomail">
<br>
<input name="Submit" type="submit" class="backc" value="提交">
</p>
</td>
</tr>
</form>
lovepost.asp如下
<%
fromname= Request.Form("fromname")
lovename=Request.Form("lovename")
tomail= Request.Form("tomail")
set conn=server.createobject("adodb.connection")
conn.open "driver={microsoft access driver (*.mdb)}; dbq="&server.mappath("lovedb.mdb")
exec="select * from lovebook"
set rs=server.createobject("adodb.recordset")
rs.open exec,conn,1,3
rs.addnew
rs("fromname")=fromname
rs("lovename")=lovename
rs("tomail")=tomail
rs.update
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
<%
set conn=server.createobject("adodb.connection")
conn.open "driver={microsoft access driver (*.mdb)}; dbq="&server.mappath("lovedb.mdb")
exec="select * from lovebook where fromname="&fromname
set rs=server.createobject("adodb.recordset")
rs.open exec,conn,1,1
%>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<%do while not rs.eof%><tr>
<td><%=rs("fromname")%></td>
<td><%=rs("lovename")%></td>
<td><%=rs("tomail")%></td>
</tr><%
rs.movenext
loop
%>
</table>
<%
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
我的love.asp文件打开后是一个FORM,填三个文本框,分别是fromname,lovename,tomail.当提交后,此三值将写入数据库,,并通过查询将它们输入到屏幕上,可为什么总是不成功呢?
请教高人!
[此贴子已经被作者于2005-12-14 21:49:48编辑过]