asp 批量修改数据 50
<%ifRequest("ac")="edit"thendimidid=request.Form("id")nid=split(id,",")eid=ubound(nid...
<%
if Request("ac")="edit" then
dim id
id=request.Form("id")
nid=split(id,",")
eid=ubound(nid)
for i = 0 to eid
Set rs=Server.CreateObject("ADODB.RecordSet")
sql="select * from TLCMS_Link Where id="&nid(i)
rs.open sql,conn,1,3
rs("types")=request.Form("types"&nid(i))
rs("ol")=request.Form("ol"&nid(i))
rs("name")=request.Form("name"&nid(i))
rs("url")=request.Form("url"&nid(i))
rs("text")=request.Form("text"&nid(i))
rs.Update
rs.Close
set rs=nothing
next
response.write "<script language=""javascript"">alert('修改成功!');location='?do=links';</script>"
end if
%>
<div class="container">
<h3 class="marginbot">链接列表<a href="?do=links&ac=add" class="sgbtn">添加新链接</a></h3>
<div class="mainbox">
<form action="?do=links&ac=edit" method="post">
<table class="datalist fixwidth">
<tr>
<th>分类</th>
<th>排列</th>
<th>名称</th>
<th>地址</th>
<th>说明</th>
<th>删除</th>
</tr>
<%
sql="select * from TLCMS_Link order by id desc"
Set rs=Server.CreateObject("ADODB.RecordSet")
rs.Open sql,conn,1,3
if rs.eof and rs.bof then
response.write" <tr>"&vbcrlf
response.write" <td colspan=""6"">暂无链接!</td>"&vbcrlf
response.write" </tr>"&vbcrlf
else
do until rs.eof
%>
<tr>
<td class="option"><input type="text" class="txt" name="types" value="<%=rs("types")%>" style="width:30px;" /></td>
<td><input type="text" class="txt" name="ol" value="<%=rs("ol")%>" style="width:30px;" /></td>
<td><input type="text" class="txt" name="name" value="<%=rs("name")%>" /></td>
<td><input type="text" class="txt" name="url" value="<%=rs("url")%>" /></td>
<td><input type="text" class="txt" name="text" value="<%=rs("text")%>" /></td>
<td><a href="?do=links&del=<%=rs("id")%>" onclick='javascript:return confirm("您确定要删除吗? ");'>删除</a></td>
</tr>
<tr class="nobg">
<td><input type="submit" value="提 交" class="btn" /></td>
<td class="tdpage" colspan="6"><font color="red">*分类:1为合作链连,2为友情链接;排行:数字越大,排行越排前.</font></td>
</tr>
</table>
</form>
</div>
</div>
谁知道怎么修改.改对了在加分.
liuyanhao 老大,用你代码,为什么修改后,数据前面会自动加空格. 展开
if Request("ac")="edit" then
dim id
id=request.Form("id")
nid=split(id,",")
eid=ubound(nid)
for i = 0 to eid
Set rs=Server.CreateObject("ADODB.RecordSet")
sql="select * from TLCMS_Link Where id="&nid(i)
rs.open sql,conn,1,3
rs("types")=request.Form("types"&nid(i))
rs("ol")=request.Form("ol"&nid(i))
rs("name")=request.Form("name"&nid(i))
rs("url")=request.Form("url"&nid(i))
rs("text")=request.Form("text"&nid(i))
rs.Update
rs.Close
set rs=nothing
next
response.write "<script language=""javascript"">alert('修改成功!');location='?do=links';</script>"
end if
%>
<div class="container">
<h3 class="marginbot">链接列表<a href="?do=links&ac=add" class="sgbtn">添加新链接</a></h3>
<div class="mainbox">
<form action="?do=links&ac=edit" method="post">
<table class="datalist fixwidth">
<tr>
<th>分类</th>
<th>排列</th>
<th>名称</th>
<th>地址</th>
<th>说明</th>
<th>删除</th>
</tr>
<%
sql="select * from TLCMS_Link order by id desc"
Set rs=Server.CreateObject("ADODB.RecordSet")
rs.Open sql,conn,1,3
if rs.eof and rs.bof then
response.write" <tr>"&vbcrlf
response.write" <td colspan=""6"">暂无链接!</td>"&vbcrlf
response.write" </tr>"&vbcrlf
else
do until rs.eof
%>
<tr>
<td class="option"><input type="text" class="txt" name="types" value="<%=rs("types")%>" style="width:30px;" /></td>
<td><input type="text" class="txt" name="ol" value="<%=rs("ol")%>" style="width:30px;" /></td>
<td><input type="text" class="txt" name="name" value="<%=rs("name")%>" /></td>
<td><input type="text" class="txt" name="url" value="<%=rs("url")%>" /></td>
<td><input type="text" class="txt" name="text" value="<%=rs("text")%>" /></td>
<td><a href="?do=links&del=<%=rs("id")%>" onclick='javascript:return confirm("您确定要删除吗? ");'>删除</a></td>
</tr>
<tr class="nobg">
<td><input type="submit" value="提 交" class="btn" /></td>
<td class="tdpage" colspan="6"><font color="red">*分类:1为合作链连,2为友情链接;排行:数字越大,排行越排前.</font></td>
</tr>
</table>
</form>
</div>
</div>
谁知道怎么修改.改对了在加分.
liuyanhao 老大,用你代码,为什么修改后,数据前面会自动加空格. 展开
3个回答
展开全部
<%
if Request("ac")="edit" then
dim id
id=request.Form("id")
types=request.Form("types")
ol=request.Form("ol")
name=request.Form("name")
url=request.Form("url")
text=request.Form("text")
nid=split(id,",")
ntypes=split(types,",")
nol=split(ol,",")
nname=split(name,",")
nurl=split(url,",")
ntext=split(text,",")
for i = 0 to ubound(nid)
Set rs=Server.CreateObject("ADODB.RecordSet")
sql="select * from TLCMS_Link Where id="&nid(i)
rs.open sql,conn,1,3
rs("types")=ntypes(i)
rs("ol")=nol(i)
rs("name")=nname(i)
rs("url")=nurl(i)
rs("text")=ntext(i)
rs.Update
rs.Close
set rs=nothing
next
response.write "<script language=""javascript"">alert('修改成功!');location='?do=links';</script>"
end if
%>
<div class="container">
<h3 class="marginbot">链接列表<a href="?do=links&ac=add" class="sgbtn">添加新链接</a></h3>
<div class="mainbox">
<form action="?do=links&ac=edit" method="post">
<table class="datalist fixwidth">
<tr>
<th>分类</th>
<th>排列</th>
<th>名称</th>
<th>地址</th>
<th>说明</th>
<th>删除</th>
</tr>
<%
sql="select * from TLCMS_Link order by id desc"
Set rs=Server.CreateObject("ADODB.RecordSet")
rs.Open sql,conn,1,3
if rs.eof and rs.bof then
response.write" <tr>"&vbcrlf
response.write" <td colspan=""6"">暂无链接!</td>"&vbcrlf
response.write" </tr>"&vbcrlf
else
do until rs.eof
%>
<tr>
<td class="option"><input type="text" class="txt" name="types" value="<%=rs("types")%>" style="width:30px;" /></td>
<td><input type="text" class="txt" name="ol" value="<%=rs("ol")%>" style="width:30px;" /></td>
<td><input type="text" class="txt" name="name" value="<%=rs("name")%>" /></td>
<td><input type="text" class="txt" name="url" value="<%=rs("url")%>" /></td>
<td><input type="text" class="txt" name="text" value="<%=rs("text")%>" /></td>
<td><a href="?do=links&del=<%=rs("id")%>" onclick='javascript:return confirm("您确定要删除吗? ");'>删除</a></td>
</tr>
<tr class="nobg">
<td><input type="submit" value="提 交" class="btn" /></td>
<td class="tdpage" colspan="6"><font color="red">*分类:1为合作链连,2为友情链接;排行:数字越大,排行越排前.</font></td>
</tr>
</table>
</form>
</div>
</div>
if Request("ac")="edit" then
dim id
id=request.Form("id")
types=request.Form("types")
ol=request.Form("ol")
name=request.Form("name")
url=request.Form("url")
text=request.Form("text")
nid=split(id,",")
ntypes=split(types,",")
nol=split(ol,",")
nname=split(name,",")
nurl=split(url,",")
ntext=split(text,",")
for i = 0 to ubound(nid)
Set rs=Server.CreateObject("ADODB.RecordSet")
sql="select * from TLCMS_Link Where id="&nid(i)
rs.open sql,conn,1,3
rs("types")=ntypes(i)
rs("ol")=nol(i)
rs("name")=nname(i)
rs("url")=nurl(i)
rs("text")=ntext(i)
rs.Update
rs.Close
set rs=nothing
next
response.write "<script language=""javascript"">alert('修改成功!');location='?do=links';</script>"
end if
%>
<div class="container">
<h3 class="marginbot">链接列表<a href="?do=links&ac=add" class="sgbtn">添加新链接</a></h3>
<div class="mainbox">
<form action="?do=links&ac=edit" method="post">
<table class="datalist fixwidth">
<tr>
<th>分类</th>
<th>排列</th>
<th>名称</th>
<th>地址</th>
<th>说明</th>
<th>删除</th>
</tr>
<%
sql="select * from TLCMS_Link order by id desc"
Set rs=Server.CreateObject("ADODB.RecordSet")
rs.Open sql,conn,1,3
if rs.eof and rs.bof then
response.write" <tr>"&vbcrlf
response.write" <td colspan=""6"">暂无链接!</td>"&vbcrlf
response.write" </tr>"&vbcrlf
else
do until rs.eof
%>
<tr>
<td class="option"><input type="text" class="txt" name="types" value="<%=rs("types")%>" style="width:30px;" /></td>
<td><input type="text" class="txt" name="ol" value="<%=rs("ol")%>" style="width:30px;" /></td>
<td><input type="text" class="txt" name="name" value="<%=rs("name")%>" /></td>
<td><input type="text" class="txt" name="url" value="<%=rs("url")%>" /></td>
<td><input type="text" class="txt" name="text" value="<%=rs("text")%>" /></td>
<td><a href="?do=links&del=<%=rs("id")%>" onclick='javascript:return confirm("您确定要删除吗? ");'>删除</a></td>
</tr>
<tr class="nobg">
<td><input type="submit" value="提 交" class="btn" /></td>
<td class="tdpage" colspan="6"><font color="red">*分类:1为合作链连,2为友情链接;排行:数字越大,排行越排前.</font></td>
</tr>
</table>
</form>
</div>
</div>
展开全部
strsql="update
表名
set
分类字段='G'
where
分类字段='"&A&"'"
conn.execute
strsql
表名
set
分类字段='G'
where
分类字段='"&A&"'"
conn.execute
strsql
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
执行sql语句sql="update
biao
set
sname='&
sname
&'
where
sname
is
null"
biao
set
sname='&
sname
&'
where
sname
is
null"
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询