asp批量修改成功和失败的代码比较

<%
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 | 查看次数: 1255
发表评论
昵 称:
密 码: 游客发言不需要密码.
邮 箱: 邮件地址支持Gravatar头像,邮箱地址不会公开.
网 址: 输入网址便于回访.
内 容:
验证码:
选 项:
虽然发表评论不用注册,但是为了保护您的发言权,建议您注册帐号.
字数限制 300 字 | UBB代码 开启 | [img]标签 关闭