大家给提提建议咯

快乐的小二兔 2010-12-29 09:50:01
我捏,想做个asp.net的多选网页
但是吧哈,这个多选我想调用一次方法就实现

然后我就琢磨出 update biao set aa=aa+1 where id=1 or id=2 这样不就更新两行数据了是不,但是吧哈,我发现把这个wehre条件 在界面传过来 不好传
如果第一条没选上的话 那么 sql语句就会出错 会变成 update biao set aa=aa+1 where or id=2
这咋办呢。

大侠都有啥好办法没
...全文
78 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
快乐的小二兔 2010-12-29
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 wwtbless 的回复:]
<input type="checkbox" name="ck">
<input type="checkbox" name="ck">
<input type="checkbox" name="ck">
<input type="checkbox" name="ck">
<input type="checkbox" name="ck">

ck = request("ck")

w……
[/Quote]
在页面里面写还是在cs文件里面写呢?
wwtbless 2010-12-29
  • 打赏
  • 举报
回复
<input type="checkbox" name="ck">
<input type="checkbox" name="ck">
<input type="checkbox" name="ck">
<input type="checkbox" name="ck">
<input type="checkbox" name="ck">

ck = request("ck")

where id in("&ck&")
yhtapmys 2010-12-29
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 id270 的回复:]
引用 1 楼 beyond_me21 的回复:
用这样的sql语句where id in(1,2),前台用复选框

但是哈 这个逗号的问题咋解决呢?
[/Quote]

你跟踪下复选框传入的那串参数,已经带有逗号。
快乐的小二兔 2010-12-29
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 beyond_me21 的回复:]
用这样的sql语句where id in(1,2),前台用复选框
[/Quote]
但是哈 这个逗号的问题咋解决呢?
暗夜螃蟹 2010-12-29
  • 打赏
  • 举报
回复
把复选框是否选中做处理,然后接收到的数据进行非空判断!
beyond_me21 2010-12-29
  • 打赏
  • 举报
回复
用这样的sql语句where id in(1,2),前台用复选框
晓风拂月 2010-12-29
  • 打赏
  • 举报
回复
[Quote=引用 12 楼 id270 的回复:]
引用 11 楼 jinhuisystem 的回复:
<script language="javascript">
function CheckAll(){
var Table=document.getElementById("tableData");
var checked=document.getElementById("checkAll");
var Checkbox=Table.g……
[/Quote]

其实是什么语法并不重要,只是给你提供一个解决问题的思路而已!
快乐的小二兔 2010-12-29
  • 打赏
  • 举报
回复
[Quote=引用 11 楼 jinhuisystem 的回复:]
<script language="javascript">
function CheckAll(){
var Table=document.getElementById("tableData");
var checked=document.getElementById("checkAll");
var Checkbox=Table.getElementsByTagName("input"……
[/Quote]
大哥感谢了。。虽然没看明白是什么语法 c#还是VB。。我都会把他一一看明白的
晓风拂月 2010-12-29
  • 打赏
  • 举报
回复
<script language="javascript">
function CheckAll(){
var Table=document.getElementById("tableData");
var checked=document.getElementById("checkAll");
var Checkbox=Table.getElementsByTagName("input");
for(var i=0;i<Checkbox.length;i++){
if(Checkbox[i].type=="checkbox"){
if (checked.checked){
if(Checkbox[i].disabled==false){
Checkbox[i].checked=true;
}
}else{
Checkbox[i].checked=false;
}
}
}
}

function GetCheckedValue(){
var CheckedValue="";
var Table=document.getElementById("tableData");
var checked=document.getElementById("checkAll");
var Checkbox=Table.getElementsByTagName("input");
for(var i=0;i<Checkbox.length;i++){
if(Checkbox[i].type=="checkbox"){
if (Checkbox[i].checked){
if(Checkbox[i].value!="全选"){
CheckedValue=CheckedValue+Checkbox[i].value+",";
}
}
}
}
return CheckedValue;
}
</script>
这些是js文件
晓风拂月 2010-12-29
  • 打赏
  • 举报
回复
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="line_table">
<tr>
<td width="1%" height="27" background="../images/news-title-bg.gif"><img src="../images/news-title-bg.gif" width="2" height="27" /></td>
<td width="98%" background="../images/news-title-bg.gif" class="left_bt2"><div align="center"><font style="font-size:22px">问题列表</font> <a href="InfoBug_Manager.asp" style="color:#FF0000">Bug列表</a></div>
<form action="InfoProblem_manager.asp?method=search" method="post">
时间段: <input type="text" name="txtStartTime" id="txtStartTime" onFocus="setday(this)" value="<%=request("txtStartTime")%>">到
<input type="text" name="txtEndTime" id="txtEndTime" onFocus="setday(this)" value="<%=request("txtEndTime")%>">
状态:<select name="selTaskState" id="selTaskState" style="width:100px;">
<option value="请选择">状态</option>
<option value="1" <%if request("selTaskState")="1" then response.Write("selected")%>>未开始</option>
<option value="2" <%if request("selTaskState")="2" then response.Write("selected")%>>处理中</option>
<option value="3" <%if request("selTaskState")="3" then response.Write("selected")%>>已完成</option>
<option value="4" <%if request("selTaskState")="4" then response.Write("selected")%>>已关闭</option>
<option value="5" <%if request("selTaskState")="5" then response.Write("selected")%>>被搁置</option>
<option value="6" <%if request("selTaskState")="6" then response.Write("selected")%>>已解决</option>
</select>
级别:<select name="selLevel" id="selLevel">
<option value="级别">选择级别</option>
<%
sql="select * from InfoQuestionLevel "
set rsLevel=conn197.execute(sql)
if not rsLevel.eof and not rsLevel.bof then
do while not rsLevel.eof
%>
<option value="<%=rsLevel("LevelID")%>" <%if request("selLevel")&""=rsLevel("LevelID")&"" then response.Write("selected")%>><%=rsLevel("LevelName")%></option>
<%
rsLevel.movenext()
loop
end if
%>
</select>
     <input type="submit" name="btnSearch" id="btnSearch" value=" 查 询 ">
               <a href='InfoProblem_add.asp' style="color:red;">添加问题</a>
</div>
</form>
</td>
</tr>
<tr>
<td height="102" valign="top"> </td>
<td height="102" valign="top">
<div style="margin-top:10px">
<table id="tableData" width="99%" border="0" cellpadding="0" cellspacing="1" style="font-size:12px" bgcolor="b5d6e6">
<tr>
<td align="left" width="5%" height="22" background="images/bg.gif" bgcolor="#FFFFFF"><input type="checkbox" name="checkAll" id="checkAll" value="全选" onClick="CheckAll()">全选</td>
<td align="center" width="15%" height="22" background="images/bg.gif" bgcolor="#FFFFFF">问题来源</td>
<td align="center" width="6%" height="22" background="images/bg.gif" bgcolor="#FFFFFF">问题级别</td>
<td align="center" width="7%" height="22" background="images/bg.gif" bgcolor="#FFFFFF">发现人</td>
<td align="center" width="12%" height="22" background="images/bg.gif" bgcolor="#FFFFFF">发现时间</td>
<td align="center" height="22" background="images/bg.gif" bgcolor="#FFFFFF">问题描述</td>
<td align="center" width="5%" height="22" background="images/bg.gif" bgcolor="#FFFFFF">进Bug库</td>
<td align="center" width="5%" height="22" background="images/bg.gif" bgcolor="#FFFFFF">状态</td>
<td align="center" width="12%" height="22" background="images/bg.gif" bgcolor="#FFFFFF">更新时间</td>
<td align="center" width="10%" height="22" background="images/bg.gif" bgcolor="#FFFFFF">操作</td>
</tr>
<%
for i=1 to rs.PageSize
if rs.EOF or rs.BOF then exit for
iq=iq+1
%>
<tr>
<td height="22" align="left" bgcolor="#FFFFFF"><input type="checkbox" id="<%=rs("ProblemID")%>" <% if rs("IsTruned")=1 then response.Write("disabled") else if rs("ProblemState")=4 then response.Write("disabled") end if %> name="<%=rs("ProblemID")%>" value="<%=rs("ProblemID")%>"></td> <td height="22" align="center" bgcolor="#FFFFFF"><%=left(rs("ProblemSource"),25)%></td>
<td height="22" align="center" bgcolor="#FFFFFF"><%=GetLevelNameByID(rs("LevelID"))%></td>
<td height="22" align="center" bgcolor="#FFFFFF"><%=rs("FindBy")%></td>
<td height="22" align="center" bgcolor="#FFFFFF"><%=rs("FindTime")%></td>
<td height="22" align="center" bgcolor="#FFFFFF">
<% if rs("ProblemState")=4 then
response.Write("<font color='Gray'>"&left(rs("Descriptions"),25)&"</font>")
else
%>
<a href="InfoProblem_add.asp?ProblemID=<%=rs("ProblemID")%>&page=<%=request("page")%>" style="color:red"><%=left(rs("Descriptions"),25)%></a>
<%
end if
%> </td>
<td height="22" align="center" bgcolor="#FFFFFF">
<%if rs("IsTruned")=2 then%>
<%if GetUserLevelByID("-99",session("USERID")) then %>
<a style='color:red' href='?method=TrunedBug&ProblemID=<%=rs("ProblemID")%>' onClick="return confirm('确定要讲该任务转入Bug库吗?')">否</a>
<%else%>
<a style="color:gray">否</a>
<%end if%>
<%end if%>
<%if rs("IsTruned")=1 then %>
<a style="color:gray">是</a>
<% end if%>
</td>
<td height="22" align="center" bgcolor="#FFFFFF"><% if rs("ProblemState")=1 then response.Write("未开始") else if rs("ProblemState")=2 then response.Write("处理中") else if rs("ProblemState")=3 then response.Write("已完成") else if rs("ProblemState")=4 then response.Write("<font color='Gray'>已关闭</font>") else if rs("ProblemState")=5 then response.Write("被搁置") else if rs("ProblemState")=6 then response.Write("已解决") end if %></td>
<td align="center" bgcolor="#FFFFFF"><%=rs("Updatetime")%></td>
<td align="center" bgcolor="#FFFFFF">
<a style="color:red" href='InfoProblem_detials.asp?ProblemID=<%=rs("ProblemID")%>'>详细</a>
<%if GetUserLevelByID("-99",session("USERID"))>0 or RoleLevel=1 or RoleLevel=2 or RoleLevel=3 then %>
<a style="color:red" onClick="return confirm ('确定要删除该问题吗?')" href='?method=del&ProblemID=<%=rs("ProblemID")%>'>删除</a>
<%else%>
<a style="color:gray">删除</a>
<%end if%>
<%if rs("ProblemState")=4 then%>
<%if GetUserLevelByID("-99",session("USERID"))>0 or RoleLevel=1 or RoleLevel=2 or RoleLevel=3 then %>
<a id="showDivPop" href="javascript:void(0);" onClick="show('pop')" style="color:red">关闭</a>
<div id="pop" class="pop" style="display:none" >
<div class="pop_head"><font style="margin-left:10px;">关闭问题来源为<font color="red"><%=rs("ProblemSource")%></font>的问题</font><a href="javascript:void(0);" onClick="hide('pop')" id="closeDiv" style="font-size:12px;font-family:Verdana, Geneva, sans-serif;line-height:14px">关闭</a></div>
<div class="pop_body">
<table width="100%" border="0">
<tr>
<td><font style="font-size:12px;font-family:Verdana, Geneva, sans-serif;line-height:14px"><strong>最终状态:</strong></font></td>
<td>
<select id="selLastState" name="selLastState">
<option value="5">被搁置</option>
<option value="6">已解决</option>
</select></td>
</tr>
<tr>
<td><font style="font-size:12px;font-family:Verdana, Geneva, sans-serif;line-height:14px"><strong>关闭理由:</strong></font></td>
<td><textarea cols="42" rows="5" name="txtClosedCause" id="txtClosedCause"></textarea></td>
</tr>
<tr align="center">
<td colspan="2"><input type="button" id="btnClose" onClick="ClosedProblem('<%=rs("ProblemID")%>')" value="关闭问题" />     <input type="button" id="btnCancel" value=" 取 消 " /></td>
</tr>
</table>
</div>
</div>
<%
else
%>
<a style="color:gray">关闭</a>
<%
end if
else
%>
<a style="color:gray">关闭</a>
<%

end if
%> </td>
</tr>
<%
rs.movenext
next
%>
</table>
晓风拂月 2010-12-29
  • 打赏
  • 举报
回复
[Quote=引用 8 楼 id270 的回复:]
引用 7 楼 jinhuisystem 的回复:
引用 4 楼 yhtapmys 的回复:
引用 3 楼 id270 的回复:
引用 1 楼 beyond_me21 的回复:
用这样的sql语句where id in(1,2),前台用复选框

但是哈 这个逗号的问题咋解决呢?


你跟踪下复选框传入的那串参数,已经带有逗号。


循环页面选中的checkbox ,把ID用逗……
[/Quote]

括号里面加的就是你要修改的id 啊,你把每一条数据的Id赋给页面的checkbox 的value值,然后取出checkbox 的value 就可以了
快乐的小二兔 2010-12-29
  • 打赏
  • 举报
回复
[Quote=引用 7 楼 jinhuisystem 的回复:]
引用 4 楼 yhtapmys 的回复:
引用 3 楼 id270 的回复:
引用 1 楼 beyond_me21 的回复:
用这样的sql语句where id in(1,2),前台用复选框

但是哈 这个逗号的问题咋解决呢?


你跟踪下复选框传入的那串参数,已经带有逗号。


循环页面选中的checkbox ,把ID用逗号隔开相连,在去掉最后一个逗号就可以了
[/Quote]
循环。。选中。。 去掉逗号、、那这个括号里面加是什么变量呢? 数字 泛型还是什么?
晓风拂月 2010-12-29
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 yhtapmys 的回复:]
引用 3 楼 id270 的回复:
引用 1 楼 beyond_me21 的回复:
用这样的sql语句where id in(1,2),前台用复选框

但是哈 这个逗号的问题咋解决呢?


你跟踪下复选框传入的那串参数,已经带有逗号。
[/Quote]

循环页面选中的checkbox ,把ID用逗号隔开相连,在去掉最后一个逗号就可以了

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧