请帮忙解决个asp批量选择修改数据的问题
在此先谢谢!
目的:批量有选择的修改数据。
目前问题:只能够修改1个选择,其他的多项选择提示错误:第 1 行: ',' 附近有语法错误
代码:
<!--#include file="../Connections/xinlong.asp" -->
<%
Set rs = Server.CreateObject("ADODB.Recordset")
rs.open"SELECT * FROM ceshi1 ORDER BY id DESC",MM_xinlong_STRING,1,1
%>
<%
Dim Repeatswt__numRows
Dim Repeatswt__index
Repeatswt__numRows = -1
Repeatswt__index = 0
rs_numRows = rs_numRows + Repeatswt__numRows
%>
<!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=utf-8" />
<title>无标题文档</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="fuxuanxiugai_1.asp">
<table width="800" border="1" cellpadding="0" cellspacing="0">
<tr>
<td align="center">选择</td>
<td align="center">ID</td>
<td align="center">名称</td>
<td align="center">数量</td>
<td align="center">水票</td>
<td align="center">备注</td>
</tr>
<%
While ((Repeatswt__numRows <> 0) AND (NOT rs.EOF))
%><tr>
<td align="center"><label>
<input type="checkbox" name="checkbox" value="<%=rs("id")%>" /><%=rs("id")%>
</label></td>
<td align="center"><label>
<input name="id" type="text" id="id" value="<%=rs("id")%>" />
</label></td>
<td align="center"><input name="mingcheng<%=rs("id")%>" type="text" id="mingcheng<%=rs("id")%>" value="<%=rs("mingcheng")%>" /></td>
<td align="center"><input name="shuliang<%=rs("id")%>" type="money" id="shuliang<%=rs("id")%>" value="<%=rs("shuliang")%>" /></td>
<td align="center"><input name="shuipiao<%=rs("id")%>" type="money" id="shuipiao<%=rs("id")%>" value="<%=rs("shuipiao")%>" /></td>
<td align="center"><input name="beizhu<%=rs("id")%>" type="text" id="beizhu<%=rs("id")%>" value="<%=rs("beizhu")%>" /></td>
</tr>
<%
Repeatswt__index=Repeatswt__index+1
Repeatswt__numRows=Repeatswt__numRows-1
rs.MoveNext()
Wend
%>
<tr>
<td align="center"> </td>
<td align="center"><label>
<input type="submit" name="Submit" value="提交" />
</label></td>
<td align="center"> </td>
<td align="center"> </td>
<td align="center"> </td>
<td align="center"> </td>
</tr>
</table>
</form>
</body>
</html>
传递到下一页代码
<!--#include file="../Connections/xinlong.asp" -->
<%
Set rs = Server.CreateObject("ADODB.Recordset")
rs.open"SELECT * FROM ceshi1 ORDER BY id DESC",MM_xinlong_STRING,1,1
%>
<%
sss=request("checkbox")
'sss的值就是选中的值,例如这样的: 1,3,5,然后使用split得到所有ID,再用循环处理
aa=split(sss,",")
for t=0 to ubound(aa)
rec_id=aa(t)'这个就是单个的ID
'这个是修改数据库数据
set rswbdx=server.CreateObject("adodb.recordset")
rswbdx.open"UPDATE ceshi1 SET mingcheng = '"&Request("mingcheng"&rec_id&"")&"',shuipiao = "&Request("shuipiao"&rec_id&"")&",shuliang = "&Request("shuliang"&rec_id&"")&",beizhu = '"&Request("beizhu"&rec_id&"")&"' WHERE id ='"&rec_id&"'",MM_xinlong_STRING,1,1
Set rswbdx = Nothing
next
%>
<!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=utf-8" />
<title>无标题文档</title>
</head>
<body>
<a href="fuxuanxiugai.asp">管理成功返回
</a>
</body>
</html>
请问如何修改。
谢谢?