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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with code

Status
Not open for further replies.

telexpress

IS-IT--Management
Oct 2, 2002
86
US
I am having this problem:

Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch
/test/aspTest2.asp, line 42

The code:
Code:
<%

Dim objConn
Set objConn = server.CreateObject(&quot;ADODB.Connection&quot;)
objConn.ConnectionString = &quot;DSN=accweb&quot;
objConn.Open

ICITEMsql = &quot;Select ICITEM.*, ICILOC.* from ICITEM, ICILOC WHERE ICITEM.ITEMNO = ICILOC.ITEMNO AND (ICILOC.QTYONHAND + ICILOC.QTYONORDER - ICILOC.QTYSALORDR) > 0&quot;

set rstemp=objConn.Execute(ICITEMsql)

%>
<table width=&quot;526&quot; border=&quot;1&quot;>
<tr> 
<td width=&quot;66&quot; nowrap>
<div align=&quot;center&quot;><strong>ITEM NUMBER</strong></div></td>
    <td width=&quot;224&quot; nowrap>
<div align=&quot;center&quot;><strong>DESCRIPTION</strong></div></td>
    <td width=&quot;111&quot; nowrap>
<div align=&quot;center&quot;><strong>HECI/CLEI</strong></div></td>
    <td width=&quot;28&quot; nowrap>
<div align=&quot;center&quot;><strong>MANUFACTURER</strong></div></td>
    <td width=&quot;28&quot; nowrap>
<div align=&quot;center&quot;><strong>CATEGORY</strong></div></td>
    <td width=&quot;29&quot; nowrap> 
<div align=&quot;center&quot;><strong>TOTAL QTY</strong></div></td>
</tr>

<%DO UNTIL rstemp.eof %>
  <tr> 
    <td valign=&quot;top&quot;><%=rstemp(&quot;ITEMNO&quot;)%></td>
    <td valign=&quot;top&quot;><%=rstemp(&quot;DESC&quot;)%></td>
    <td valign=&quot;top&quot;><%=rstemp(&quot;OPTFLD6&quot;)%></td>
    <td valign=&quot;top&quot;><%=rstemp(&quot;OPTFLD3&quot;)%></td>
    <td valign=&quot;top&quot;><%=rstemp(&quot;CATEGORY&quot;)%></td>
    <td valign=&quot;top&quot;>

<********************* Problem Starts Here*********************>

<%
totalquantity = rstemp(&quot;QTYONHAND&quot;) + rstemp(&quot;QTYONORDER&quot;) -rstemp(&quot;QTYSALORDR&quot;)
response.Write(totalquantity)            
%>

<******************************************************>

</td>
</tr>
<%
rstemp.movenext
LOOP
%>
</table>

<%
rstemp.close
set rstemp=nothing
objConn.Close
set objConn=nothing
%>
 
are these intetgers?
rstemp(&quot;QTYONHAND&quot;) + rstemp(&quot;QTYONORDER&quot;) -rstemp(&quot;QTYSALORDR&quot;)

_____________________________________________________________________
onpnt2.gif
[sub]
Hakuna matata!!
[/sub]
 
Yes, although some records don't have values for QTYONORDER, or QTYSALORDR, or QTYONHAND in the database.
 
try cInt() ing the values

_____________________________________________________________________
onpnt2.gif
[sub]
Hakuna matata!!
[/sub]
 
I get theis message when cint() is inserted:

Error Type:
Microsoft VBScript runtime (0x800A0006)
Overflow: 'cInt'
/test/aspTest2.asp, line 42


 
I figured out the problem, instead of cInt() I used cLng() because if you use cInt(), you cannot go past the bounds of [-32768 , 32767]. Thank you for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top