簡體   English   中英

Microsoft VBScript 編譯錯誤“800a03f6”預期“結束”

[英]Microsoft VBScript compilation error '800a03f6' Expected 'End'

我無法弄清楚為什么我不斷收到如下錯誤:

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>標記之前進行。

我注意到您沒有檢查是否有任何數據被返回(即EOFBOF

盡量避免使用表格進行布局 - 沒有理由使用它們,請嘗試使用 div。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM