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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jdom
    New Member
    • Sep 2008
    • 10

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

    i have been struggling with this error for a while , i changed to many times to make sure no error but no luck


    Error on line 29
    strsql.Paramete rs("@columna") = strmake




    <%

    Dim objCN ' ADO Connection object
    Dim objRS ' ADO Recordset object
    Dim strsql ' SQL query string
    Dim RecordsArray ' To hold the Array returned by GetRows
    Dim i ' A counter variable
    Dim strmake
    Dim objDBParam3

    ' Create a connection object
    Set objCN = Server.CreateOb ject("ADODB.Con nection")

    ' Connect to the data source
    objCN.Open "coonection ;"
    set strsql = Server.CreateOb ject("ADODB.Com mand")
    strsql.ActiveCo nnection = objCN
    strsql.CommandT ext = "SELECT model ,CAT_ID FROM new WHERE CAT_ID = ? "
    strsql.CommandT ype = 1

    strmake = "1"
    If (Request.QueryS tring("catid") <> "") Then
    strmake = Request.QuerySt ring("catid")
    End If

    set objDBParam3 = strsql.CreatePa rameter("@colum na",5, 1, -1)
    strsql.Paramete rs.Append objDBParam3
    strsql.Paramete rs("@columna") = strmake
    set objDBParam3 = Nothing
    set objRS = strsql.Execute

    If objRS.EOF Then

    Response.Write "Erreur"
    Response.End
    end if
    RecordsArray = objRS.GetRows()

    %>
    <input name="marque" type="hidden" value="<%=Recor dsArray(2, i) %>" >
    <select name="model" onchange="getCa rburation(<%= RecordsArray(1, i) %>,this.value)" >
    <option value="">Tous</option>
    <% For i = 0 To UBound(RecordsA rray, 2)%>


    <option value="<%=Recor dsArray(0, i)%>"><%=Record sArray(0, i)%></option>
    <%
    Next
    Response.write "</select>"
    'End if
    objRS.Close
    objCN.Close
    Set objCN = Nothing
    Set objRS = Nothing
    %>

    I appreciate your help
  • jdom
    New Member
    • Sep 2008
    • 10

    #2
    Any one has any idea?

    Thank you

    Comment

    • jhardman
      Recognized Expert Specialist
      • Jan 2007
      • 3405

      #3
      The best way to troubleshoot SQL issues are to 1- print out the sql commands (or queries) and 2- enter them directly into a query analyzer. You shouldbe able to see the same error. Have you tried entering it into a query analyzer yet?

      Jared

      Comment

      • FredrikS
        New Member
        • Sep 2009
        • 4

        #4
        I'm not sure how sql parameters work but should you not convert the parameter to an integer? They are strings in your code.

        Comment

        • lakshmanmcaj
          New Member
          • Jul 2006
          • 35

          #5
          Please tell error code

          Hi,

          Please give the error code or error msg....

          Please try this

          strsql.Paramete rs("@columna") = strmake

          strsql.Paramete rs("@columna") = Cint(strmake)


          I dont know correct solution.post your error msg..

          Comment

          Working...