asp网页制作代码修改?

来源:百度知道 编辑:UC知道 时间:2024/05/22 01:10:56
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>

<body>
<%
Dim db
set db=Server.CreateObject("ADODB.Connection")
db.Open "net"
Dim strSql
strSql="Delete From link Where link_id=link_id"
db.Execute(strSql)
Response.Write "已经成功删除"
response.Redirect("index.asp")
%>
</body>
</html>

我这个删除代码为什么我一点删除,它就把数据表中的数据全部删除?

strSql="Delete From link Where link_id=link_id"

呵呵,你没指定删除那个linkid,而每条记录中link_id是绝对等于自身的。所以当然删除所有的。

改成
strSql="Delete From link Where link_id=" & reqeust.quesystring("link_id")就行了。

你link_id这个变量是怎么得来的?
link_id=reqeust("link_id")'加一行
要保证你表里每条记录link_id的值是唯一的.