asp批量修改成功和失败的代码比较
作者:wang 日期:2009-10-19
<%
dim fenban,xuesheng,xuanze
fenban = request.form("fb")
xuesheng = request.form("xuanze")
xuanze = split(xuesheng,",")
set connq = server.CreateObject("ADODB.connection")
connq.connectionstring = "driver={SQL Server}; server=192.168.100.207;uid=sa;pwd=szweb05;database=shizhu_2009"
connq.open
if (request.form("action")="del") and (request.form("xuanze")<>"") then
for i = 0 to ubound(xuanze)
set rs=server.createobject("adodb.recordset")
set rs.activeconnection = connq
rs.cursortype=3
sql= "update student set fb = "&fenban&" where id ="&xuanze(i)
rs.open sql,conn,1,3
rs("fb") = fb
rs.update
next
end if
%>
<%
response.Write "
"
response.Write fenban
response.Write "
"
response.Write xuesheng
%>
返回
......................................................
<%
dim fenban,xuesheng
fenban = request.form("fb")
xuesheng = request.form("xuanze")
set connq = server.CreateObject("ADODB.connection")
connq.connectionstring = "driver={SQL Server}; server=;uid=sa;pwd=;database="
connq.open
if (request.form("action")="del") and (request.form("xuanze")<>"") then
connq.execute "update student set fb = "&fenban&" Where id IN ("&cstr(xuesheng)&")"
response.Write("批量修改该学生分班数据成功")
end if
%>
<%
response.Write "
"
response.Write fenban
response.Write "
"
response.Write xuesheng
%>
返回
错误的原因,是在调用变量的时候,没有使用 "&变量名&" 。
dim fenban,xuesheng,xuanze
fenban = request.form("fb")
xuesheng = request.form("xuanze")
xuanze = split(xuesheng,",")
set connq = server.CreateObject("ADODB.connection")
connq.connectionstring = "driver={SQL Server}; server=192.168.100.207;uid=sa;pwd=szweb05;database=shizhu_2009"
connq.open
if (request.form("action")="del") and (request.form("xuanze")<>"") then
for i = 0 to ubound(xuanze)
set rs=server.createobject("adodb.recordset")
set rs.activeconnection = connq
rs.cursortype=3
sql= "update student set fb = "&fenban&" where id ="&xuanze(i)
rs.open sql,conn,1,3
rs("fb") = fb
rs.update
next
end if
%>
<%
response.Write "
"
response.Write fenban
response.Write "
"
response.Write xuesheng
%>
返回
......................................................
<%
dim fenban,xuesheng
fenban = request.form("fb")
xuesheng = request.form("xuanze")
set connq = server.CreateObject("ADODB.connection")
connq.connectionstring = "driver={SQL Server}; server=;uid=sa;pwd=;database="
connq.open
if (request.form("action")="del") and (request.form("xuanze")<>"") then
connq.execute "update student set fb = "&fenban&" Where id IN ("&cstr(xuesheng)&")"
response.Write("批量修改该学生分班数据成功")
end if
%>
<%
response.Write "
"
response.Write fenban
response.Write "
"
response.Write xuesheng
%>
返回
错误的原因,是在调用变量的时候,没有使用 "&变量名&" 。
[本日志由 wang 于 2009-10-22 04:13 PM 编辑]
上一篇: Access2000資料庫80萬記錄通用快速ASP分頁類下一篇: ASP页面实现Excel数据批量导入MSSQL问题
文章来自: 本站原创
引用通告: 查看所有引用 | 我要引用此文章
Tags:
相关日志:
评论: 0 | 引用: 0 | 查看次数: 2520
发表评论