Microsoft VBScript 编译错误"800a03f6"预期"结束"



我不明白为什么我总是出现如下错误:

VBScript编译错误'800a03f6'预计"结束"

我怀疑错误来自下面的代码,但我不确定哪一部分是错误的主要原因。

 <% if objRS.state = 1 then objRS.close
    set objRS = nothing
    objDB.close
    set objRS = nothing
    set objDB = nothing
%>
有人能帮我一下吗?

我把大部分代码放在下面。

<div class="content span9">
<div class="panel">
    <h2 class="title">Donation</h2>
    <div class="panel_content">
<form name="eForm" id="eForm" method="post" action="reg_prc.asp"        onsubmit="return verify();" AUTOCOMPLETE="off">
<table width="70%" align="center">
    <%
    strSQL = "SELECT M.*, C.fldName AS fldCountryName FROM tblMembership M     INNER JOIN tblCountry C ON M.fldCountryID=C.fldID WHERE M.fldID=" &     cSQLStr(objSession.getVal("UserID"))
    objDB.getRec strSQL, errNo, errDesc, objRS
    if objRS.eof then   
    else
        dim strStatus
    if objRS("fldStatus") = "A" then
        strStatus = "ACTIVE"
    elseif objRS("fldStatus") = "D" then
        strStatus = "DISABLED"
    end if
%>
<tr>
    <td>
    <table width="90%" align="center">
    <!-- Username -->
<tr>
    <td width="34%" align="right"> <%=larr(74)%></td>
    <td width="1%" align="center">:</td>
    <td width="65%" align="left"><b><%=objRS("fldCode") %></b></td>
</tr>
     <tr>
        <td>&nbsp;</td>
    </tr>
    <!-- Coporate -->
<tr>
    <td width="34%" align="right"><%=larr(75)%></td>
    <td width="1%" align="center">:</td>
    <td width="65%" align="left"><input type="text" name="txtICNo"  id="txtICNo" maxlength="30" size="30" onkeypress="return changeKey(this, event, filterText);"/></td>
</tr>
     <tr>
        <td>&nbsp;</td>
    </tr>
    <!-- Address -->
<tr>
    <td width="34%" align="right"><%=larr(82)%></td>
    <td width="1%" align="center">:</td>
    <td width="65%" align="left"><b><%=objRS("fldAddress1") %></b><!--<input   type="text" name="txtAddress1" id="txtAddress1" maxlength="200" size="50" />-->    </td>
</tr>
<tr>
    <td width="34%" align="right"></td>
    <td width="1%" align="center"></td>
    <td width="65%" align="left"><b><%=objRS("fldAddress2") %></b><!--<input type="text" name="txtAddress2" id="txtAddress2" maxlength="200" size="50" />-->    </td>
</tr>
    <tr>
    <td width="34%" align="right"></td>
    <td width="1%" align="center"></td>
    <td width="65%" align="left"><b><%=objRS("fldAdress3") %></b><!--<input type="text" name="txtAddress2" id="Text1" maxlength="200" size="50" />--></td>
</tr>
    <tr>
    <td width="34%" align="right"></td>
    <td width="1%" align="center"></td>
    <td width="65%" align="left"><b><%=objRS("fldCity") %></b><!--<input type="text" name="txtAddress2" id="Text2" maxlength="200" size="50" />--></td>
</tr>
    </tr>
    <tr>
    <td width="34%" align="right"></td>
    <td width="1%" align="center"></td>
    <td width="65%" align="left"><b><%=objRS("fldstate") %></b><!--<input type="text" name="txtAddress2" id="Text2" maxlength="200" size="50" />--></td>
</tr>
     <tr>
        <td>&nbsp;</td>
    </tr>
    <!-- mobile phone number -->
<tr>
    <td width="34%" align="right"><%=larr(88)%></td>
    <td width="1%" align="center">:</td>
    <td width="65%" align="left"><b><%=objRS("fldMobileNo") %></b><!--<input type="text" id="txtMobileNo" name="txtMobileNo" maxlength="20" value="" />-->    </td>
</tr>
     <tr>
        <td>&nbsp;</td>
    </tr>
    <!-- Email Address -->
<tr>
        <td width="34%" align="right"><%=larr(441)%></td>
        <td width="1%" align="center">:</td>
        <td width="65%" align="left"><b><%=objRS("fldEmail") %></b><!--<input type="text" id="txtEmail" name="txtEmail" maxlength="50" value="" size="40" />--></td>
    </tr>
         <tr>
            <td>&nbsp;</td>
        </tr>
        <!--Quantity of trees donation -->
    <tr>
        <td width="34%" align="right"><%=larr(89)%></td>
        <td width="1%" align="center">:</td>
        <td width="65%" align="left">
            <select name="slctTreeQty" id ="slctTreeQty" onblur="calDonationAmt()" onchange="calDonationAmt()">
                <option value="0">Please Select Quantity of Tree</option>
                <option value="10">10</option>
                <option value="100">100</option>
                <option value="1000">1000</option>
                <option value="10000">10,000</option>
                <option value="100000">100,000</option>
            </select>
            <span class="style1" style="font-size:small">*Every Tree cost USD10</span> </td> 
    </tr>
         <!-- total amount of donation -->
    <tr>
        <td width="34%" align="right"><%=larr(90)%></td>
        <td width="1%" align="center">:</td>
        <td width="65%" align="left"><span id="totalDonationAmt" style="font-weight:bold"></span></td>
    </tr>
         <tr>
            <td>&nbsp;</td>
        </tr>
    </table>
    </td>
</tr>
</table>
    <table width="100%" align="center">
    <tr>
        <td align="center">
        <table>
        <tr>
            <td><input type="submit" name="btnPayment" id="btnPayment" value="<%=larr(168)%>"/></td>
            <td><input type="submit" name ="btnContact" id="btnContact" value="<%=larr(81)%>"  /></td>
        </tr>
        </table>
        </td>
    </tr>
    </table>
</form>
</div><!--end of panel content-->
</div><!--end of panel-->
</div><!--end of content-->
</body>
<%  if objRS.state = 1 then objRS.close
    set objRS = nothing
    objDB.close
    set objRS = nothing
    set objDB = nothing
%>
</html>

根据Lankymart的指针:

if objRS.eof then   
else
    dim strStatus
    if objRS("fldStatus") = "A" then
        strStatus = "ACTIVE"
    elseif objRS("fldStatus") = "D" then
        strStatus = "DISABLED"
    end if
    ...
END IF <=========================================

或者,您可以正确地编写如下代码:

If Not objRS.eof Then   
    dim strStatus
    if objRS("fldStatus") = "A" then
        strStatus = "ACTIVE"
    elseif objRS("fldStatus") = "D" then
        strStatus = "DISABLED"
    end if
    ...
End If

我怀疑最后的End If需要在关闭</table>标签之前。

我注意到您没有检查是否返回任何数据(即EOF BOF

尽量避免在布局中使用表格——没有理由使用它们,尝试使用div代替。

相关内容

最新更新