If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > data type problem

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-12-04, 09:02
jmaresca2004 jmaresca2004 is offline
Registered User
 
Join Date: Oct 2004
Posts: 6
data type problem

i am trying draw data from 2 seperate databases to be displayed on the same page. If i comment out the second connection on my page i get the data from the first database to display. when its uncommented i get this error.

ERROR >> ADODB.Command error '800a0d5d'

Application uses a value of the wrong type for the current operation.

<< ERROR

It seems that when ever i attempt to draw data from a db with the data type of Numeric i get this problem.

here is the code, i have highlighted the error line.

<%@ Language=VBScript %>

<%
'If (Session("UserName") = "") or (Session("Password") = "") then
' Response.Redirect "default.asp"
'End if

Const adVarChar = 200
Const adNumeric = 131
Const adDouble = 5
'Const adInteger = 3
Const adParamInput = &H0001

Dim objConn
Dim objCmd
Dim objRS

Dim manufacturer
Dim description
Dim itemnmbr
Dim gpnmbr
DIM QTYONHAND


If len(trim(Request("manufacturer"))) = 0 then
manufacturer = "%"
Else
manufacturer = "%" & Request("manufacturer") & "%"
End if

If len(trim(Request("description"))) = 0 then
description = "%"
Else
description = "%" & Request("description") & "%"
End if

If len(trim(Request("itemnmbr"))) = 0 then
itemnmbr = "%"
Else
itemnmbr = "%" & Request("itemnmbr") & "%"
End if

If len(trim(Request("gpnmbr"))) = 0 then
gpnmbr = "%"
Else
gpnmbr = "%" & Request("gpnmbr") & "%"
End if

If len(trim(Request("QTYONHAND"))) = 0 then
QTYONHAND = "%"
Else
QTYONHAND = "%" & Request("QTYONHAND") & "%"
End if


'*************** MAKE CONNECTION ********************
Set objConn = CreateObject("ADODB.Connection")
objConn.Open Application("Conn_ConnectionString")

Set objCmd=Server.CreateObject("ADODB.Command")
objCmd.ActiveConnection=objConn
'******* STORED PROCEDURE CALL********
objCmd.CommandText="_SP_ProductSearch"
objCmd.CommandType=4
objCmd.Parameters.Append objCmd.CreateParameter ("@manufacturer",adVarChar,adParamInput,200,manufa cturer)
objCmd.Parameters.Append objCmd.CreateParameter ("@description",adVarchar,adParamInput,200,descrip tion)
objCmd.Parameters.Append objCmd.CreateParameter ("@itemnmbr",adVarchar,adParamInput,200,itemnmb r)
objCmd.Parameters.Append objCmd.CreateParameter ("@gpnmbr",adVarChar,adParamInput,200,gpnmbr)



set objRS = objCmd.Execute
%>
<%
'Const adNumeric = 131

Dim objCmd2
Dim objRS2
Dim objConn2

Set objConn2 = CreateObject("ADODB.Connection")
objConn2.Open Application("Conn_ConnectionString2")

Set objCmd2=Server.CreateObject("ADODB.Command")
objCmd2.ActiveConnection=objConn2
objCmd2.CommandText="_SP_ProductSearch_qoh"
objCmd2.CommandType=4

ERROR LINE >> objCmd2.Parameters.Append objCmd2.CreateParameter ("@QTYONHND",adNumeric,adParamInput,9,QTYONHAND ) << ERROR LINE

set objRS2 = objCmd2.Execute
%>
<html>
<head><LINK REL="stylesheet" type="text/css" HREF="master.css">


</head>

<body>
<TABLE border="1" bordercolor="black" width="100%" >
<tr>
<td width="7%" align="center" ><b>Item #</b></td>
<td width="7%" align="center" ><b>Great Plains #</b></td>
<td width="30%" align="center" ><b>Description</b></td>
<td width="7%" align="center"><b>Manufacturer</b></td>
<td width="7%" align="center"><b>Quantity on Hand</b></td>
</tr>

<%Dim counter
counter = 1

Do until objRs.EOF

if counter mod 2 = 0 then
response.write("<TR bgcolor='white'>")
else
response.Write("<TR bgcolor='white'>")
end if%>

<td align=center><font size=1> <%=objRs.fields("dummy_model_num")%> </font></td>
<td align=center><font size=1> <%=objRs.fields("gp_model_num")%> </font></td>
<td align=center><font size=1><%=objRs.fields("description")%></font></td>
<td align=center ><font size=1><%=objRs.fields("manufacturer")%></font></td>
<td align=center ><font size=1><%=objRS2.fields("QTYONHND")%></font></td>

</tr>
<%counter = counter + 1
objRs.MoveNext
Loop

' set objAssignedRS = nothing
Set objRS = nothing
objConn.Close
Set objConn = nothing
%>


</table>


<center><a href="javascript:window.close()"><font size="2" ><b>Close Window</b></font></a></center>

</BODY>
</HTML>
Reply With Quote
  #2 (permalink)  
Old 10-12-04, 19:18
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
try changing you line to this...
Code:
objCmd2.Parameters.Append objCmd2.CreateParameter ("@QTYONHND",adNumeric,adParamInput,9,Cint(QTYONHAND))
You need to make sure that qtyonhand is a numeric as you have declared it as that in the parameters
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On