Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2004
    Posts
    6

    Unanswered: 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>

  2. #2
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •