当前位置:编程学习 > C#/ASP.NET >>

大家好.请帮我看一下为什么是死循环啊/一点道理也没有啊?谢谢了.

content.xml内容如下:
<?xml version="1.0" encoding="utf-8" ?> 
- <chat>
  <msg>聊天内容</msg> 
- <Info>
  <id>158242347</id> 
  <user>[aa]</user> 
  <sex>boy</sex> 
  <ip>127.0.0.1</ip> 
  <userInTime>2007-8-14 17:11:04</userInTime> 
  </Info>
- <Info>
  <id>158242348</id> 
  <user>[bb]</user> 
  <sex>girl</sex> 
  <ip>127.0.0.1</ip> 
  <userInTime>2007-8-14 17:11:09</userInTime> 
  </Info>
- <Info>
  <id>158242349</id> 
  <user>[cc]</user> 
  <sex>boy</sex> 
  <ip>127.0.0.1</ip> 
  <userInTime>2007-8-14 17:11:14</userInTime> 
  </Info>
  </chat>
asp中的程序如下:
set xmldoc=server.CreateObject("MSXML.DOMDocument")
xmldoc.load(server.MapPath("content.xml"))
set root=xmldoc.documentElement          '获取根节点
for i=1 to root.childNodes.length-1
    if root.childNodes(i).childNodes(1).childNodes(0).text = "[aa]" then
root.childNodes(i).childNodes(4).childNodes(0).Text=now()
exit for
   end if
next
//不知道为什么,单独执行上面的程序正常,单独执行下面的程序也正常,但是如果把上面的和下面的放在同一个页面代码中,则会经过大约3分钟才能把这几行代码执行完毕,
不知道哪里出了问题了,请大家帮忙看一下.
i=1
L= root.childNodes.length-1
do while  i<=L
if DateDiff("s",(root.childNodes(i).childNodes(4).childNodes(0).Text),now()) > 10  then
root.removeChild(root.childNodes(i))
if L = root.childNodes.length-1 then
i=i+1
else
i=1
         L=root.childNodes.length-1
end if
end if
loop
xmldoc.save(server.MapPath("content.xml")) '写完数据之后保存文档
--------------------编程问答-------------------- asp我不懂!UP! --------------------编程问答-------------------- 既然可以执行完,就不是死循环拉 --------------------编程问答-------------------- 也许是,

因为两段代码的公用了一个 i 变量, 互相影响了

分开命名 --------------------编程问答-------------------- ASP不懂哎
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,