日期:2014-05-17  浏览次数:21434 次

成批更新记录,只有第一条记录能更新,其它都更新不了。急!急!急!检查一上午了
语句如下:
id=request( "id ")
nid=split(id, ", ")
eid=ubound(nid)

llcjup=request( "llcj ")
nllcjup=split(llcjup, ", ")
sjcjup=request( "sjcj ")
nsjcjup=split(sjcjup, ", ")

Set   conn=Server.CreateObject( "ADODB.Connection ")
conn.Open   "Provider=Microsoft.Jet.OLEDB.4.0;Data   Source= "&Server.MapPath( "data\ygxx.mdb ")

%>
<%  
for   i=0   to   eid
      sql_update= "update   studentinfo   set   llcj= ' "&nllcjup(i)& " ',sjcj= ' "&nsjcjup(i)& " '   where   xh= ' "&nid(i)& " ' "
      conn.execute(sql_update)

next
%>
执行后没有报告错误,但是只能更新第一条记录,其它记录都更新不了,请求帮助。急!急!急!

------解决方案--------------------
不用循环的直接sql_update= "update studentinfo set llcj= ' "&nllcjup(i)& " ',sjcj= ' "&nsjcjup(i)& " ' where xh in( "&(id)& ") "

------解决方案--------------------

aa=1
for c=1 to 6
ZXTimes=trim(request.Form( "ZXTimes "&c))
BiYexx=trim(request.Form( "BiYexx "&c))
Zhuanye=trim(request.Form( "Zhuanye "&c))
XueLi=trim(request.Form( "XueLi "&c))
Nxian=trim(request.Form( "Nxian "&c))
if BiYexx= " " then
BiYexx= "&nbsp; "
end if
if Zhuanye= " " then
Zhuanye= "&nbsp; "
end if
if XueLi= " " then
XueLi= "&nbsp; "
end if
if Nxian= " " then
Nxian= "&nbsp; "
end if
if ClubId <> " " and ZXTimes <> " " and BiYexx <> " " and XueLi <> " " and Nxian <> " " then
aa=aa+1
ddrs.open "insert into vipjypx (ClubId,ZXTimes,BiYexx,Zhuanye,XueLi,Nxian) values ( ' "&ClubId& " ', ' "&ZXTimes& " ', ' "&BiYexx& " ', ' "&Zhuanye& " ', ' "&XueLi& " ', ' "&Nxian& " ') ",conn,1,3 '///////教程培训信息录入
end if
next

给你一个类似的例子