请问asp更新页程序怎么写?

来源:百度知道 编辑:UC知道 时间:2024/06/28 07:32:59
我想实现更改数据库记录的程序。从搜索页向更新页怎么传递参数?更新页怎么写?更新页是通过在表单中修改。
搜索页:
<form id="form" name="form" method="post" action="结果页.asp">
AA:
<label>
<input type="text" name="textfield" />
</label>
<label>
<input type="submit" name="Submit" value="提交" />
</label>
</form>
结果页:
<%
response.Write("<table border='1'><tr><td>编号</td><td>AA</td></tr>")
set rs=server.CreateObject("ADODB.Recordset")
rs.open "select * from s1 where AA LIKE '%"& request.Form("textfield") &"%'","DSN=ss;"
set bh=rs("编号")
set AA=rs("AA")
while not rs.eof
response.Write("<tr><td><a href='

最关键是取得ID,然后在UPDATE数据库里的对应的ID。你写的没有ID:response.Write("<tr><td><a href='http://localhost/结果页.asp?="&bh&"' target='_self'应该是:
response.Write("<tr><td><a href='http://localhost/结果页.asp?编号1="&bh&"' target='_self'
然后在更新页:
ID=request("编号1"),然后就更新

SQL=“UPDATE TB SET ...=... WHERE 编号=“&ID
CONN.EXECUTE(SQL)
当然这个是举例,实际中编号尽量写成ID,

你要更新数据。
http://localhost/结果页.asp?id="&bh&"&textfield="&request.Form("textfield")&"

id是编号。