September 11, 2002 at 7:01 am
I'm having an error with a procedure. There is a parameter with datatype int (@ethnicity int=null) and it inserts the passed data to a column. The datatype of the column is int (Ethnicity int null). I'm using Command object to call the procedure and here's the line for that parameter:
objCmd.Parameters.Append objCmd.CreateParameter("@ethnicity", adInteger, adParamInput, 2, Session("Ethnicity"))
It's allowed that the user can leave this option empty, so the Session("Ethnicity") can be empty. But if it's empty then the Command object gives me this error:
"Application uses a value of the wrong type for the current operation."
What should I do for this?
September 11, 2002 at 8:51 pm
I'm assuming the Session("Ethnicity") is being set with a zero length string when no value is entered. This will fail. A Null will work and a valid integer will work as will a float which will get truncated.
So either check the value before you assign the parameter <isnumeric(Session("Ethnicity") )> and substitute the value with something that won't error (this may require changes to the procedure internals depending what you're doing) or change the procedure parameter to a varchar and handle it all within the procedure assigning the value to a different variable of data type int.
cheers,
Mike
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply