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

  • Hi Guys,

    I'm Randy and a newbie here so pardon if i have miss some other requirement to post my question in this forum.

    Here it goes, i'm supporting our legacy system and my boss ask me to check one of the error on the ASP thing..., unfortunately i'm not really that familiar so i'm seeking the advice of the guys here in the forum.

    The error encountered as mention in the subject:

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

    according to the microsoft website that this is cause by wrong declaration of the variable, i've attached the part of the script where my declaration and calling of the SP in the ASP file.

    sp_web_update_dependent (stored procedure)

    parameter data type length

    @rt_memberid varchar 20

    @email varchar 60

    @loginid varchar 20

    @company varchar 60

    @occupation varchar 60

    @hint_cd varchar 4

    @hint_answer varchar 255

    @business_typevarchar4 default value ''

    ASP Declaration:

    Cmd.Parameters.Append Cmd.CreateParameter("member_id",adVarchar,adParamInput,20)

    Cmd.Parameters.Append Cmd.CreateParameter("email",adVarchar,adParamInput,60)

    Cmd.Parameters.Append Cmd.CreateParameter("logid",adVarchar,adParamInput,20)

    Cmd.Parameters.Append Cmd.CreateParameter("company",adVarchar,adParamInput,60)

    Cmd.Parameters.Append Cmd.CreateParameter("occupation",adVarchar,adParamInput,60)

    Cmd.Parameters.Append Cmd.CreateParameter("hint_cd",adVarchar,adParamInput,4)

    Cmd.Parameters.Append Cmd.CreateParameter("hint_answer",adVarchar,adParamInput,60)

    As far as what i can see is that they have the same declaration, but i'm not sure why i have this error message.

    If anybody can give me any advice on how i can check further this error message or if the got some solution it is great appreciated.

    Thanks to all, have a good day ahead 🙂

  • Hi Guys,

    Good day, anybody has a possible advice from where i can continue searching the possible cause of this error? Appreciate it very much. Thanks

  • I'm no expert in ASP, but your hint_answer in the ASP code is a different size to the table declaration, and the business_type column isn't represented at all...

  • Hi Paul, thanks for your reply, yeah same here i'm also not very familiar with this ASP, i'm not really sure whether it could be the problem as per what i understand from SQL, i can call an SP without specifying the value, provided in the SP declaration you stated "default" as for business the default is '' (empty space), for hint_answer my SP is actually more 255 and the ASP only passing 60 varchar, but maybe i try to change it and ask my boss to compile the file, hopefully these would solve the problem. 😀

    its giving me a nightmare.... as my boss keep on chasing me...

    thanks again paul.

  • rmata_76 (7/3/2011)


    Hi Guys,

    I'm Randy and a newbie here so pardon if i have miss some other requirement to post my question in this forum.

    Here it goes, i'm supporting our legacy system and my boss ask me to check one of the error on the ASP thing..., unfortunately i'm not really that familiar so i'm seeking the advice of the guys here in the forum.

    The error encountered as mention in the subject:

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

    according to the microsoft website that this is cause by wrong declaration of the variable, i've attached the part of the script where my declaration and calling of the SP in the ASP file.

    sp_web_update_dependent (stored procedure)

    parameter data type length

    @rt_memberid varchar 20

    @email varchar 60

    @loginid varchar 20

    @company varchar 60

    @occupation varchar 60

    @hint_cd varchar 4

    @hint_answer varchar 255

    @business_typevarchar4 default value ''

    ASP Declaration:

    Cmd.Parameters.Append Cmd.CreateParameter("member_id",adVarchar,adParamInput,20)

    Cmd.Parameters.Append Cmd.CreateParameter("email",adVarchar,adParamInput,60)

    Cmd.Parameters.Append Cmd.CreateParameter("logid",adVarchar,adParamInput,20)

    Cmd.Parameters.Append Cmd.CreateParameter("company",adVarchar,adParamInput,60)

    Cmd.Parameters.Append Cmd.CreateParameter("occupation",adVarchar,adParamInput,60)

    Cmd.Parameters.Append Cmd.CreateParameter("hint_cd",adVarchar,adParamInput,4)

    Cmd.Parameters.Append Cmd.CreateParameter("hint_answer",adVarchar,adParamInput,60)

    As far as what i can see is that they have the same declaration, but i'm not sure why i have this error message.

    If anybody can give me any advice on how i can check further this error message or if the got some solution it is great appreciated.

    Thanks to all, have a good day ahead 🙂

    Hard to know if its a typo when you posted the question or if this exists in your code. But if its there it could be that.

    /T

  • Hi tommyh, yes these how it was written in the program, i believe these is not a typo error, i can see the variable being used somewhere in the ASP file. 🙂

Viewing 6 posts - 1 through 5 (of 5 total)

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