今天遇到怪事情了,大家帮忙看看,谢谢了
我用sql查询数据库结果是3条记录,用循环把数据插入另外一个表,怎么每次都只插入第一条?我把代码在我机器上看来,能够插入多条啊,但是放到服务器上就不行了,都郁闷了,帮忙看看啊
Sql = "Select Title ,ClassID,Content from News where ID in ( " & MoveNewsList & ") order by id desc "
dim i
dim rs
Set RsNewsObj = Server.CreateObject( "ADODB.RecordSet ")
RsNewsObj.Open Sql,Conn,1,3 这条语句查询结果为多条
rsnewsobj.movefirst
SysNewsSql = "Select * from Articles where 1=0 "
Set rs = Server.CreateObject( "ADODB.RecordSet ")
rs.Open SysNewsSql,Conn,3,3
do while not RsNewsObj.eof
SysTemplet = "/Templets/News/article.htm "
rs.AddNew
rs( "Title ") = RsNewsObj( "Title ")
rs( "subTitle ") = " "
rs( "TitleStyle ") = "#UUUUUU "
rs( "ClassID ") = RsNewsObj( "ClassID ")
rs( "Content ") = RsNewsObj( "Content ")
rs( "NewsTemplet ") = SysTemplet
rs( "KEYWORDS ") = " "
rs( "txtsource ") = " "
rs( "author ") = " "
rs( "auditTF ") = "1 "
rs( "editer ") = " "
rs( "specialid ") = " "
rs( "username ") = session( "username ")
rs( "auditor ") = "admin "
rs( "orderid ") = getorderid()
rs( "refreshtf ") = "0 "
rs( "clicknum ") = "0 "
rs( "picnewstf ") = "0 "
rs( "newstypetf ") = "1 "
rs.UpDate
MoveNewsNum = MoveNewsNum + 1
RsNewsObj.movenext
loop
rs.close
set rs= nothing
Set RsNewsObj = Nothing
------解决方案--------------------你本机没有问题,说明代码没有问题,帖了代码也没用,加几句输出看有没有循环吧,我看是你本机的数据库和服务器的数据库内容不一样,查询出来的也不语言,服务器的没查到记录
------解决方案--------------------看看你服务器上的数据库里是不是有多条数据