假设地址:http://localhost/del.asp?id=1&id=3&id=6&id=7&id=8
这样写对不对?删除多条记录
<%
id=request.querystring("id")
sql="delete····where id=" & id
%>
如果是字符串呢?
假设地址:http://localhost/del.asp?name=apple01&name=apple02&name=apple03
<%
name=request.querystring("name")
sql="delete····where name='" & name & "'"
%>
麻烦各位帮我一下,如果可以,写一下简单语句给我学习!
8 个解决方案
#1
删除多条记录为:sql = "delete from data where ID in (ID1,ID2,ID3)"
已经解决!
疑问1:
假设删除留言回复记录,有多个记录,每天记录多个ID!u_id,c_id!
怎么删除呢?
疑问2:
删除多条记录为:sql = "delete from data where name in (name1,name2,name3)"
namei 为取的变量,要不要加单引号?
已经解决!
疑问1:
假设删除留言回复记录,有多个记录,每天记录多个ID!u_id,c_id!
怎么删除呢?
疑问2:
删除多条记录为:sql = "delete from data where name in (name1,name2,name3)"
namei 为取的变量,要不要加单引号?
#2
你给多少分?
#3
看看下面的代码就明白了,
checkall.asp
<%
if request("B1")<>"" then
c1=request("C1")
response.write c1 & "<br>"
selected=split(c1,",")
for i=0 to Ubound(selected)
response.write selected(i) & "<br>"
next
end if
%>
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title></title>
<script language=javascript>
function checkall(ss){
var kk;
var max;
max=ss.elements.length-1;
for(kk=1;kk<max;kk++)
ss.elements[kk].checked=ss.elements[0].checked;
}
</script>
</head>
<body>
<form method="POST" action="checkall.asp">
<p><input type="checkbox" name="C2" value="ON" onclick="checkall(this.form);">全选</p>
<p><input type="checkbox" name="C1" value="1"></p>
<p><input type="checkbox" name="C1" value="2"></p>
<p><input type="checkbox" name="C1" value="3"></p>
<p><input type="submit" value="提交" name="B1"> </p>
</form>
</body>
</html>
checkall.asp
<%
if request("B1")<>"" then
c1=request("C1")
response.write c1 & "<br>"
selected=split(c1,",")
for i=0 to Ubound(selected)
response.write selected(i) & "<br>"
next
end if
%>
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title></title>
<script language=javascript>
function checkall(ss){
var kk;
var max;
max=ss.elements.length-1;
for(kk=1;kk<max;kk++)
ss.elements[kk].checked=ss.elements[0].checked;
}
</script>
</head>
<body>
<form method="POST" action="checkall.asp">
<p><input type="checkbox" name="C2" value="ON" onclick="checkall(this.form);">全选</p>
<p><input type="checkbox" name="C1" value="1"></p>
<p><input type="checkbox" name="C1" value="2"></p>
<p><input type="checkbox" name="C1" value="3"></p>
<p><input type="submit" value="提交" name="B1"> </p>
</form>
</body>
</html>
#4
慢了
#5
要是字符加''
数字不加
数字不加
#6
where id in()就行了
#7
sqlstr="delete from bbs where id in ("&request("id")&")"
#8
同意星星,用checkbox选择后提交处理就行。
#1
删除多条记录为:sql = "delete from data where ID in (ID1,ID2,ID3)"
已经解决!
疑问1:
假设删除留言回复记录,有多个记录,每天记录多个ID!u_id,c_id!
怎么删除呢?
疑问2:
删除多条记录为:sql = "delete from data where name in (name1,name2,name3)"
namei 为取的变量,要不要加单引号?
已经解决!
疑问1:
假设删除留言回复记录,有多个记录,每天记录多个ID!u_id,c_id!
怎么删除呢?
疑问2:
删除多条记录为:sql = "delete from data where name in (name1,name2,name3)"
namei 为取的变量,要不要加单引号?
#2
你给多少分?
#3
看看下面的代码就明白了,
checkall.asp
<%
if request("B1")<>"" then
c1=request("C1")
response.write c1 & "<br>"
selected=split(c1,",")
for i=0 to Ubound(selected)
response.write selected(i) & "<br>"
next
end if
%>
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title></title>
<script language=javascript>
function checkall(ss){
var kk;
var max;
max=ss.elements.length-1;
for(kk=1;kk<max;kk++)
ss.elements[kk].checked=ss.elements[0].checked;
}
</script>
</head>
<body>
<form method="POST" action="checkall.asp">
<p><input type="checkbox" name="C2" value="ON" onclick="checkall(this.form);">全选</p>
<p><input type="checkbox" name="C1" value="1"></p>
<p><input type="checkbox" name="C1" value="2"></p>
<p><input type="checkbox" name="C1" value="3"></p>
<p><input type="submit" value="提交" name="B1"> </p>
</form>
</body>
</html>
checkall.asp
<%
if request("B1")<>"" then
c1=request("C1")
response.write c1 & "<br>"
selected=split(c1,",")
for i=0 to Ubound(selected)
response.write selected(i) & "<br>"
next
end if
%>
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title></title>
<script language=javascript>
function checkall(ss){
var kk;
var max;
max=ss.elements.length-1;
for(kk=1;kk<max;kk++)
ss.elements[kk].checked=ss.elements[0].checked;
}
</script>
</head>
<body>
<form method="POST" action="checkall.asp">
<p><input type="checkbox" name="C2" value="ON" onclick="checkall(this.form);">全选</p>
<p><input type="checkbox" name="C1" value="1"></p>
<p><input type="checkbox" name="C1" value="2"></p>
<p><input type="checkbox" name="C1" value="3"></p>
<p><input type="submit" value="提交" name="B1"> </p>
</form>
</body>
</html>
#4
慢了
#5
要是字符加''
数字不加
数字不加
#6
where id in()就行了
#7
sqlstr="delete from bbs where id in ("&request("id")&")"
#8
同意星星,用checkbox选择后提交处理就行。