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

  • I am getting this error when trying to run my asp code "Application uses a value of the wrong type for the current operation". I can execute the query thru query analyzer, and it runs fine with the 75 character string. Running it thru asp, I can only enter 50 characters before it chokes. Here is the asp...

    Set objData2 = Server.CreateObject("ADODB.Command")

    objData2.ActiveConnection = cn

    objData2.CommandText = "sp_Grammar_Update"

    objData2.CommandType = 4

    SET objParam1 = objData2.CreateParameter("@ObjID",129, 1, 50)

    objData2.Parameters.Append objParam1

    objData2.Parameters("@ObjID") = REQUEST("ObjID")

    SET objParam2 = objData2.CreateParameter("@Title",200, 1, 50)

    objData2.Parameters.Append objParam2

    objData2.Parameters("@Title") = REQUEST("txtTit")

    SET objParam3 = objData2.CreateParameter("@desc",200, 1, 50)

    objData2.Parameters.Append objParam3

    objData2.Parameters("@desc") =REQUEST("txtDesc")

    Set rstData2 = objData2.execute

    Any ideas would be greatly appreciated!

  • http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/mdmthcreateparam.asp

    Set parameter = command.CreateParameter (Name, Type, Direction, Size, Value)

    You are setting your parameter lengths to 50. 

    SET objParam1 = objData2.CreateParameter("@ObjID",129, 1, 50)

    Set the length value to 75, and it should accept 75-character strings.

    -Eddie

    Eddie Wuerch
    MCM: SQL

  • Thanks so much! Silly oversite.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply