日期:2014-05-17  浏览次数:21026 次

asp 高手来
表单1
<form name="form1" method="post" action="exam8.asp">
请输入要修改的记录的ID:
<input type="text" name="name">
<br>
<input type="submit" name="submit" value="提交">
</form>

ASP 程序1 

<%
set conn=server.createobject("adodb.connection")
conn.open "driver={microsoft access driver (*.mdb)};dbq="&server.mappath("data/guestbook.mdb")

exec="select * from guest where id="&request.form("name") '感觉这有错

set rs=server.createobject("adodb.recordset")
rs.open exec,conn
%>
<form name="form1" method="post" action="modifysave.asp">
<table width="748" border="0" cellspacing="0" cellpadding="0">
<tr> 
<td>name</td>
<td>tel</td>
<td>message</td>
</tr>
<tr> 
<td>
<input type="text" name="name" value="<%=rs("name")%>">
</td>
<td>
<input type="text" name="tel" value="<%=rs("tel")%>">
</td>
<td>
<input type="text" name="message" value="<%=rs("message")%>">
<input type="submit" name="Submit" value="提交">
<input type="hidden" name="id" value="<%=request.form("id")%>">
</td>
</tr>
</table>
</form>
<%
rs.close
set rs=nothing
conn.close
set conn=nothing
%>

asp程序2

<%
set conn=server.createobject("adodb.connection")
conn.open "driver={microsoft access driver (*.mdb)};dbq="&server.mappath("data/guestbook.mdb")

exec="select * from guest where id="&request.form("name") ’这好像也不对

set rs=server.createobject("adodb.recordset")
rs.open exec,conn,1,3

rs("name")=request.form("name") ’这好像也是不对
rs("tel")=request.form("tel")
rs("message")=request.form("message")

rs.update
rs.close
set rs=nothing
conn.close
set conn=nothing
response.write "修改记录成功!"
%>



另外问一下 “name” '" & name & "' '" + name + "' 三者有什么区别 &与+在好像在这个程序里作用一样

------解决方案--------------------
exec="select * from guest where id="&request.form("name") ’这好像也不对

应该是是
exec="select * from guest where id="&request.form("id")