Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unspecified error

Status
Not open for further replies.

loveday

Programmer
Sep 19, 2004
106
US
I beg of you experts for your patience and expertise in resolving this error.

I have been dealing with this now for 2 days.

It really is kicking my tail.


I have 3 segments of code.

I will post the one that is having the error but if you have questions that relate to other pages, I will post the relevant part.

The error I am getting now says:

Unspecified error on this line:

rsFetch.open sSQLFetchCost, oActiveConnection, 1, 3, 1

I am just trying to make my checkout.asp file work
Code:
<% 
'procedure builds Cart contents table - isubTotal is the return value for the total 
sub showCartOut(isubTotal,lCustZip,oActiveConnection) 
    'double quote character 
    q = chr(34) 
    %> 

        <table border=0 cellPadding=3 cellSpacing=2 width="100%"> 
        <tr background="images/lefttop.jpg"> 
        <td background="images/1_nav_color.jpg" class="body1"><FONT color=white>Product code</FONT></td> 
        <td background="images/1_nav_color.jpg" class="body1"><FONT color=white>Product name</FONT></td> 
        <td background="images/1_nav_color.jpg" class="body1"><FONT color=white>Quantity</FONT></td> 
        <td background="images/1_nav_color.jpg" class="body1"><FONT color=white>Unit Price</FONT></td> 
        <td background="images/1_nav_color.jpg" class="body1"><FONT color=white>Total</FONT></td></tr> 

<% 
Dim fd, sd 

for sd=0 to ubound(arrCart,2) 

  for fd=0 to ubound(arrCart,1) 
    response.write "arrCart("&fd&", "&sd&"): "& arrCart(fd, sd) & " 
" 
  next 

next 

%> 

     <% 
        Dim lOrderWeight 
        lOrderWeight = 0 
        isubtotal = 0 

         For i = 1 to scartItem 
               lNDPrice = arrCart(cUnitPrice,i) 
               lAIPPrice = arrCart(cAIPPrice,i) 
               lBulkPrice = arrCart(cBulkPrice,i) 
               lCurrentQuantity = arrCart(cQuantity,i) 
               lOrderWeight = lOrderWeight + (arrCart(cshippingWeight,i) * lCurrentQuantity) 
               lThisPrice = lNDPrice 
               if bIsAIPCustomer=true then 
                 '' ***REMEMBER*** -- you need to add your AIP logic here; 
                 '' ***you said you were going to develop this, and I don't have it, so you need to add it in here. 
                 '' The customer is an AIP customer; give him the price. 
                 lThisPrice = lAIPPrice 
                 if sDisReason <>"" then 
                   sDisReason = "You are an AIP customer." 
                 end if 
               elseif cint(lCurrentQuantity)>=10 then 
                 '' The customer qualifies for a bulk discount 
                 lThisPrice = lBulkPrice 
                 if sDisReason <>"" then 
                   sDisReason = "Bulk discount applies to items ordered in quantites of 10 or more." 
                 end if 
               end if 
               lExtPrice = lThisPrice * lCurrentQuantity 

                strHTML = strHTML & "<tr bgColor=navajowhite>" 
                strHTML = strHTML & "<td><small><input name=selected"& Cstr(i) & " type=checkbox value=""yes"" checked>" 
                strHTML = strHTML & arrCart(cProductCode,i) &"</small></td>" 
                strHTML = strHTML & "<td><small>" & arrCart(cProductname,i) & "</small></td>" 
                strHTML = strHTML & "<td><small><input type=""text"" size=""4"" name=""quantity" & CStr(i) & """ value=""" & arrCart(cQuantity,i) & """></small></td>" 
               %> 
                <td><small><%= FormatCurrency(lThisPrice,2)%> </small></td> 
                <td><small><%= FormatCurrency(lExtPrice,2) %> </small></td> 
               </tr> 
              <% 
                isubtotal = isubtotal + lExtPrice 
          Next 
             response.write "lOrderWeight: "& lOrderWeight & " 
" 
        %> 

        <tr> 
          <td></td><td></td><td></td> 
          <td background='images/lefttop.jpg'><font color=steelblue>Sub-total</font></td> 
          <td bgColor=lightgoldenrodyellow> <%= FormatCurrency(isubtotal,2) %></td> 
        </tr> 
      <% 
    '---------add new shipping cost code---------- 
    Dim lShippingCost 
    'Dim lCustZip : lCustZip = rs("czip") 
    lShippingCost = getShippingCharges(lCustZip, lOrderWeight, oActiveConnection) 
   %> 
   <tr> 
       <td></td> 
       <td></td> 
       <td align='right'> 
           <font color='midnightBLUE'></font> 
       </td> 
       <td background='images/lefttop.jpg' nowrap> 
           <font color=000000><%=lShippingCost%></font> 
       </td> 
       <td bgColor=lightgoldenrodyellow> 
           <%= FormatCurrency(lShippingCost,2) %> 
       </td> 
   </tr> 
<% 
'---------add new shipping cost code---------- 

        isubtotal = isubtotal + lShippingCost 
%> 

  <tr> 
    <td></td><td></td><td></td> 
    <td background='images/lefttop.jpg'><font color=steelblue>Total</font></td> 
    <td bgColor=lightgoldenrodyellow> <%= FormatCurrency(isubtotal,2)%></td> 
  </tr> 
</table> 
<% 
response.write strHTML 
end sub 

'---------insert function to calculate shipping cost---------- 
Function getShippingCharges(lShippingZipCode, lOrderWeight, oActiveConnection) 
  Dim lShippingCharges 
  Dim sSQLFetchCost 
  sSQLFetchCost = "SELECT S.* FROM tblShipping S " & _ 
                                 " INNER JOIN Zones Z ON " & _ 
                                 " S.Zone=Z.Zone " & _ 
                                 " WHERE Z.LowZip <= '" & lShippingZipCode & "' " & _ 
                                 " AND Z.HighZip >= '" & lShippingZipCode & "' " & _ 
                                 " AND S.fromWeight <= " & lOrderWeight & " " & _ 
                                 " AND S.toWeight >= " & lOrderWeight 
  Dim rsFetch : set rsFetch = server.createobject("adodb.recordset") 
  rsFetch.open sSQLFetchCost, oActiveConnection, 1, 3, 1 
  if not rsFetch.eof then 
    lShippingCharges = rsFetch("shippingCharges") 
  else 
    lShippingCharges = 0 
  end if 
  rsFetch.close 
  set rsFetch = nothing 
  lShippingCharges = formatCurrency(lShippingCharges, 2) 
  getShippingCharges = lShippingCharges 
End Function 
'---------insert function to calculate shipping cost---------- 

%>

Please excuse the long code.

I will be more than happy to provide additional info.

Thanks in advance
 
A lot of times, when you receive an error on the line where you are attempting to open a recordset, the problem lies in your SQL code. The easiest thing to check is that you are running your SQL correctly. I would response.write your SQL string and test it in whatever DB you are using to make certain that it is correct. Just do a response.write after you create your SQL string and then a response.end so that you can see it on the screen.

------------------------------------------------------------------------------------------------------------------------
If you don't have a sense of humor, you probably don't have any sense at all.
- Anonymous
 
hi Chopstick,

As embarrassed as I am to say this, it never occured to me to do response.write.

Thanks for the reminder.

I took the sql to an access database (that's what I am using) and ran it like this:

SELECT S.* FROM tblShipping S
INNER JOIN Zones Z ON S.Zone=Z.Zone
WHERE Z.LowZip <= 99999
AND Z.HighZip >=30000
AND S.fromWeight <=140
AND S.toWeight >= 120

From doing this, I discovered that I have my zipcodes and weight defined as text.

I changed them to Number data type and it displayed data correctly.

However, when I went to my query again in my asp code, made some changes to it, I still got the same error.

Here is the current changes.

Please tell me if I missed something giving now that zipcode and fromWeight, toWeight and shippingWeight are all now number data types.

Code:
  sSQLFetchCost = "SELECT S.* FROM tblShipping S " & _
                                 " INNER JOIN Zones Z ON " & _
                                 " S.Zone=Z.Zone " & _
                                 " WHERE Z.LowZip <= " & lShippingZipCode & " " & _
                                 " AND Z.HighZip >= " & lShippingZipCode & " " & _
                                 " AND S.fromWeight <= " & lOrderWeight & " " & _
                                 " AND S.toWeight >= " & lOrderWeight
  Dim rsFetch : set rsFetch = server.createobject("adodb.recordset")

Thanks much for the help.

BTW, I did response.write but got everything displayed except shippingcharges.
 
I forgot to post the sql code I am getting after response.write:

SELECT S.* FROM tblShipping S INNER JOIN Zones Z ON S.Zone=Z.Zone WHERE Z.LowZip <= AND Z.HighZip >= AND S.fromWeight <= 8 AND S.toWeight >= 8

All I am trying to do is get shippingCharges where zipcode is between lowzip and highzip and totalweight is between fromWeight and toWeight.
 
Based on your last post, you have no value that you are testing for the Z.LowZip and Z.HighZip. Essentially, there is no value in your lShippingZipCode variable. That would definitely cause your problem.

------------------------------------------------------------------------------------------------------------------------
If you don't have a sense of humor, you probably don't have any sense at all.
- Anonymous
 
Even after I manually assign values to lshippingZipCode, I still get that error.

This is really, really annoying.
 
After you manually assign the values, response.write the query that you get and then test it in your database to ensure that it is indeed working the way you think it should.

------------------------------------------------------------------------------------------------------------------------
If you don't have a sense of humor, you probably don't have any sense at all.
- Anonymous
 
Can anyone, please, please help with this problem.

It doesn't matter what I try, I can't seem to get over this "Unspecified error" message.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top