一个ASP的小问题,高手帮忙解答下。

来源:百度知道 编辑:UC知道 时间:2024/05/31 17:13:59
end if
if op_type="clean" then

sql="delete from bin"
conn.execute(sql)
conn.close
set conn=nothing
ErrMsg=ErrMsg &"用户["& UserName &"]清理成功"
response.write ErrMsg
Response.End

end if

这个是清理数据库的代码,
<table width="350" border="0" cellspacing="8" cellpadding="0" align="center">

<tr>
<td align="right" height="24">操作:</td>
<td height="24"><select size="1" name="op_type">
<option value="list">列表</option>
<option value="clean">清理</option>
</select>

</td>
</tr>
<tr align="center">

这个现在是通过表单控件传递值并判断的,所以不改清理数据库的这段代码是不行的.
给你个参考意见,
把if op_type="clean" then和end if去掉,选不选都清空
或者你用asp网址传值,比如 clean.asp?op_type='clean'
然后清理数据代码段if op_type="clean" then改成if request("op_type")="clean" then

yy.asp?op_type=k

程序如下:

op_type=request("op_type")
if op_type<>"" then
sql="delete from bin"
conn.execute(sql)
conn.close
set conn=nothing
ErrMsg=ErrMsg &"用户["& UserName &"]清理成功"
response.write ErrMsg
Response.End
end if

收ASP徒弟,学费二百,有意联系百度HI

你的网站后面加 ?op_type=clean

前提是

if op_type="clean" then

的前面获取op_type的时候:

op_type=request("op_type")



op_type=request.querystring("op_type")

而不能是

op_type=request.form("op_type")