为什么会出现Microsoft VBScript 编译器错误 800a0400'缺少语句的错误?
Microsoft VBScript 编译器错误 '800a0400'
缺少语句
\wwwroot\student.asp, line 49
下面是源码:
<%@ language="VBScript" %>
<%
t1 = Request.Form("T1")
t2 = Request.Form("T2")
t3 = Request.Form("T3")
t4 = Request.Form("T4")
t5 = Request.Form("T5")
t6 = Request.Form("T6")
t7 = Request.Form("T7")
if t1="" OR t2="" OR t5="" then Response.Write "有必填数据没有填写!" else
set xmldoc = server.createObject("MSXML.DOMDocument")
xmldoc.async = "false"
xmldoc.load(server.mappath("studentInfor.xml"))
set root = xmldoc.DocumentElement
set newNode1 = xmldoc.CreateElement("student")
root.AppendChild(newNode1)
set newNode2 = xmldoc.CreateElement("SN")
newNode1.AppendChild(newNode2)
newNode2.text = t1
set newNode2 = xmldoc.CreateElement("Name")
newNode1.AppendChild(newNode2)
newNode2.text = t2
set attrNode=xmldoc.CreateAttribute("sex")
newNode2.setAttributeNode(attrNode)
attrNode.text="T6"
set attrNode=xmldoc.CreateAttribute("birth")
newNode2.setAttributeNode(attrNode)
attrNode.text="T7"
newNode1.AppendChild(newNode2)
set newNode2 = xmldoc.CreateElement("Class")
newNode1.AppendChild(newNode2)
newNode2.text = t3
set newNode2 = xmldoc.CreateElement("Tel")
newNode1.AppendChild(newNode2)
newNode2.text = t4
set newNode2 = xmldoc.CreateElement("Email")
newNode1.AppendChild(newNode2)
newNode2.text = t5
xmldoc.save(server.mappath("student.xml"))
set xmldoc = nothing
Response.Write"客户数据已成功添加!"
end if //这里是49行
%>
[解决办法]
<%t1 = Request.Form("T1") t2 = Request.Form("T2")t3 = Request.Form("T3")t4 = Request.Form("T4") t5 = Request.Form("T5")t6 = Request.Form("T6") t7 = Request.Form("T7") if t1="" OR t2="" OR t5="" Then Response.Write "有必填数据没有填写!"else set xmldoc = server.createObject("MSXML.DOMDocument") xmldoc.async = "false" xmldoc.load(server.mappath("studentInfor.xml")) set root = xmldoc.DocumentElement set newNode1 = xmldoc.CreateElement("student") root.AppendChild(newNode1) set newNode2 = xmldoc.CreateElement("SN") newNode1.AppendChild(newNode2) newNode2.text = t1 set newNode2 = xmldoc.CreateElement("Name") newNode1.AppendChild(newNode2) newNode2.text = t2 set attrNode=xmldoc.CreateAttribute("sex") newNode2.setAttributeNode(attrNode) attrNode.text="T6" set attrNode=xmldoc.CreateAttribute("birth") newNode2.setAttributeNode(attrNode) attrNode.text="T7" newNode1.AppendChild(newNode2) set newNode2 = xmldoc.CreateElement("Class") newNode1.AppendChild(newNode2) newNode2.text = t3 set newNode2 = xmldoc.CreateElement("Tel") newNode1.AppendChild(newNode2) newNode2.text = t4 set newNode2 = xmldoc.CreateElement("Email") newNode1.AppendChild(newNode2) newNode2.text = t5 xmldoc.save(server.mappath("student.xml")) set xmldoc = nothing Response.Write"客户数据已成功添加!" end If%>
------解决方案--------------------
<%@ language="VBScript" %><%t1 = Request.Form("T1") t2 = Request.Form("T2")t3 = Request.Form("T3")t4 = Request.Form("T4") t5 = Request.Form("T5")t6 = Request.Form("T6") t7 = Request.Form("T7") if t1="" OR t2="" OR t5="" then Response.Write "有必填数据没有填写!"else set xmldoc = server.createObject("MSXML.DOMDocument") xmldoc.async = "false" xmldoc.load(server.mappath("studentInfor.xml")) set root = xmldoc.DocumentElement set newNode1 = xmldoc.CreateElement("student") root.AppendChild(newNode1) set newNode2 = xmldoc.CreateElement("SN") newNode1.AppendChild(newNode2) newNode2.text = t1 set newNode2 = xmldoc.CreateElement("Name") newNode1.AppendChild(newNode2) newNode2.text = t2 set attrNode=xmldoc.CreateAttribute("sex") newNode2.setAttributeNode(attrNode) attrNode.text="T6" set attrNode=xmldoc.CreateAttribute("birth") newNode2.setAttributeNode(attrNode) attrNode.text="T7" newNode1.AppendChild(newNode2) set newNode2 = xmldoc.CreateElement("Class") newNode1.AppendChild(newNode2) newNode2.text = t3 set newNode2 = xmldoc.CreateElement("Tel") newNode1.AppendChild(newNode2) newNode2.text = t4 set newNode2 = xmldoc.CreateElement("Email") newNode1.AppendChild(newNode2) newNode2.text = t5 xmldoc.save(server.mappath("student.xml")) set xmldoc = nothing Response.Write"客户数据已成功添加!" end if //这里是49行%>