Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Application uses a value of the wrong type for the current operation in classic asp

Tags:

asp-classic

I am calling one stored procedure using the following code:

m_objCmd.CommandText = "StoredProc_Name"
m_objCmd.Parameters.Append m_objCmd.CreateParameter("@UserID", 3, 1, 0, UserID)
m_objCmd.Parameters.Append m_objCmd.CreateParameter("@UserTypeID", 3, 1, 0, UserTypeID)
m_objCmd.Parameters.Append m_objCmd.CreateParameter("@AccessToken", 202, 1, 100, AccessToken)
m_objCmd.Parameters.Append m_objCmd.CreateParameter("@TokenExpiration", 135, 1, 0, TokenExpiration)
m_objCmd.Parameters.Append m_objCmd.CreateParameter("@RefreshToken", 202, 1, 100, RefreshToken)

rsUserData.Open m_objCmd, , adOpenStatic, adLockReadOnly  

In above:

  • @UserID is a 'int' dataType
  • @UserTypeID is 'int'
  • @AccessToken is nVarchar(100)
  • @TokenExpiration is datatime(2)
  • @RefreshToken is nVarchar(100)

But here I am getting the error:

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

Can any one help me please.

like image 371
Jagadeesh Avatar asked Dec 02 '11 10:12

Jagadeesh


1 Answers

I had this same problem just a few days ago. My problem was overflow as Kul-Tigin suggests below.

I was trying to insert a huge string 17,000+ characters in length and I received exactly the same error as you. I then opted to save the string in a text file and I used the table as a file locator so-to-speak.

Check the length of the values in the following:

  • @UserID is a 'int' dataType
  • @UserTypeID is 'int'
  • @AccessToken is nVarchar(100)
  • @TokenExpiration is datatime(2)
  • @RefreshToken is nVarchar(100)
like image 84
TheCarver Avatar answered Oct 12 '22 21:10

TheCarver