原程式:<html>
<head>
<meta content="Microsoft FrontPage 5.0">
<meta content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>認證軟體認證檢查</title>
</head>
<body>
<!--#include file="dbconn.asp"-->
<p align="center"><font color="#FF0000" size="7">尋找漏掉滾動的監督組織資訊 </font></p>
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" height="98">
<tr>
<td width="5%" height="41" align="center" bgcolor="#FFFF00">
<font color="#0000FF">編號</font></td>
<td width="8%" height="41" align="center" bgcolor="#FFFF00">
<font color="#0000FF">記錄序號</font></td>
<td width="21%" height="41" align="center" bgcolor="#FFFF00">
<font color="#0000FF">組織名稱</font></td>
<td width="8%" height="41" align="center" bgcolor="#FFFF00">
<font color="#0000FF">項目編號</font></td>
<td width="1%" height="41" align="center" bgcolor="#FFFF00">
<font color="#0000FF">項目類型</font></td>
<td width="11%" height="41" align="center" bgcolor="#FFFF00">
<font color="#0000FF">實際開始日期</font></td>
<td width="12%" height="41" align="center" bgcolor="#FFFF00">
<font color="#0000FF">實際結束日期</font></td>
<td width="17%" height="41" align="center" bgcolor="#FFFF00">
<font color="#0000FF">認證狀態</font></td>
</tr>
<%
set rs=server.createobject("adodb.recordset")
sql="select a.RecNO RecNo,a.ProjID ProjID,d.PTType PTType,a.ActBegin ActBegin,a.ActEnd ActEnd,c.BsName BsName,a.PTCode PTCode,b.RegiMemo RegiMemo from tblProjectType a,tblProject b,tblBusiness c,tblProjectTypeCode d,tblProjRegi e where (a.PTCode='200' or a.PTCode='300' or a.PTCode='301' or a.PTCode='302' or a.PTCode='303') and a.PTCode=d.PTCode and a.ProjID=b.ProjID and b.BsID=c.BsID and a.ProjID=e.ProjID and e.RegiCase<>'撤消' order by a.ProjID,a.PTCode"
rs.open sql,conn,1,1
i=0
do while not rs.eof
%>
<% dim RecNO,BsName,ProjID,PTType,ActBegin,ActEnd,PTCode,RegiMemo
RecNo=rs("RecNo")
BsName=rs("BsName")
ProjID=rs("ProjID")
PTType=rs("PTType")
PTCode=rs("PTCode")
ActBegin=rs("ActBegin")
ActEnd=rs("ActEnd")
RegiMemo=rs("RegiMemo")
rs.MoveNext
if rs("ProjID")<>projID and ActEnd<>"" then
i=i+1
%>
<tr>
<td width="5%" height="56" align="center"><%=i%></td>
<td width="8%" height="56" align="center"><%=RecNo %> </td>
<td width="21%" height="56" align="center"><%=BsName%> </td>
<td width="8%" height="56" align="center"><%=ProjID%> </td>
<td width="8%" height="56" align="center"> <%=PTType%></td>
<td width="11%" height="56" align="center"> <%=ActBegin%></td>
<td width="12%" height="56" align="center"><%=ActEnd%> </td>
<td width="17%" height="56" align="center" valign="middle" bgcolor="#FFCCFF"><%=RegiMemo%><br>
</td>
</tr>
<%
end if
loop
%>
</table>
</body>
</html>
錯誤提示:asp中 Microsoft VBScript 編譯器錯誤 錯誤 '800a03f6'
缺少 'End'
/iisHelp/common/500-100.asp,行242 錯誤 '80020009'
發生意外。
原因及解決:開始只以為是語法錯誤,查了很多遍,主要在 END IF上查,都沒找到原因,加個end if又提示多了,提示在if rs("ProjID")<>projID and ActEnd<>"" then
發生錯誤,於是想修改一下,
<% dim RecNO,BsName,ProjID,PTType,ActBegin,ActEnd,PTCode,RegiMemo,projID2
RecNo=rs("RecNo")
BsName=rs("BsName")
ProjID=rs("ProjID")
PTType=rs("PTType")
PTCode=rs("PTCode")
ActBegin=rs("ActBegin")
ActEnd=rs("ActEnd")
RegiMemo=rs("RegiMemo")
rs.MoveNext
if not rs.eof then
projID2=rs("ProjID")
if projID2<>projID and ActEnd<>"" then
i=i+1
%>
<tr>
<td width="5%" height="56" align="center"><%=i%></td>
<td width="8%" height="56" align="center"><%=RecNo %> </td>
<td width="21%" height="56" align="center"><%=BsName%> </td>
<td width="8%" height="56" align="center"><%=ProjID%> </td>
<td width="8%" height="56" align="center"> <%=PTType%></td>
<td width="11%" height="56" align="center"> <%=ActBegin%></td>
<td width="12%" height="56" align="center"><%=ActEnd%> </td>
<td width="17%" height="56" align="center" valign="middle" bgcolor="#FFCCFF"><%=RegiMemo%><br>
</td>
</tr>
<%
end if
end if
OK,成功,原來是 rs.movenext 到底了沒檢測造成的,而END 是VB系統的,並不是程式中的提示的錯誤,微軟的一個誤導。