2016-08-15 70 views
0

我對ASP的確不太熟悉,但我管理的網站正在將該錯誤分發給我。下面是從站點的完整代碼:在結帳購物車上獲取Microsoft VBScript運行時錯誤「800a0009」

Microsoft VBScript運行錯誤 '800a0009' 標超出範圍: '[數:1]' /shopping_sub.asp,線715

這裏是從697-728的代碼:

'Response.write strPass & "<p>"  
    'Response.write "Response: " & strResp 
    'Response.end 

    If strResp="ERROR" then 
     RESULT_num_shipping_options = -1 
     Session("ShipErrMsg")="To continue your order, please contact customer service regarding your contact information. Thank you." 
    Else  
     RESULT_num_shipping_options=1 

     vResp=Split(strResp,":") 

     Dim RESULT_shipping_description_array(4) 
     Dim RESULT_shipping_amount_array(4) 

     For I = 0 to UBound(vResp) 
       vResp2=Split(vResp(I),"|") 
       RESULT_shipping_description_array(I)=vResp2(0) 
       RESULT_shipping_amount_array(I)=vResp2(1) 

     Next    
    End If  

Else 
    RESULT_num_shipping_options = -1 
    cShipping=0 
End If 
End If 

'Response.write "Weight: " & siWeight & "<br/>" 
'Response.write "Zip: " & receiverpostalcode & "<br/>" 
'Response.write "Country: " & receivercountrycode & "<br/>" 

它似乎開始運作後,7項已添加到購物車,但任何小於該返回錯誤。

這不會發生在所有產品上,所以有什麼想法?

回答

1

您是否使用過調試器來確定vResp的值和vResp2的數組長度?

我的猜測是這個迴應不是你所期望的。如果您無法強制api始終具有正確的響應,那麼您需要通過在嘗試訪問該值之前檢查分割響應的長度來防止該響應。

我看到的另一個問題是無關的,就是如果UBound(vResp)_> 4,那麼你會得到類似的錯誤

相關問題