AppendParameter and type mismatch value (1 Viewer)

DevAccess

Registered User.
Local time
Today, 02:42
Joined
Jun 27, 2016
Messages
321
Hello

I have below code

Code:
  With adoCmd
         adoStream.Type = adTypeBinary
         adoStream.Open
         adoStream.LoadFromFile strDir + file 'It fails if file is open
        .CommandText = "INSERT INTO VendorFiles VALUES (?,?,?)" ' Query
        .CommandType = adCmdText
        
        '---adding parameters
       adoCmd.Parameters.Append .CreateParameter("UniqueKey", adVarChar, adParamInput, Keyaudit)

Here I am getting type mismatch error
Code:
 adoCmd.Parameters.Append .CreateParameter("UniqueKey", adVarChar, adParamInput, Keyaudit)
I also tried
Code:
 adoCmd.Parameters.Append .CreateParameter("UniqueKey", adVarChar, adParamInput, 0,Keyaudit)

but it does not work, please advise.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 17:42
Joined
May 7, 2009
Messages
19,247
What is the datatype of keyaudit. If numeric use adVarNumeric
 

DevAccess

Registered User.
Local time
Today, 02:42
Joined
Jun 27, 2016
Messages
321

Attachments

  • error.PNG
    error.PNG
    4 KB · Views: 92

DevAccess

Registered User.
Local time
Today, 02:42
Joined
Jun 27, 2016
Messages
321
Here is the attached error.

adoCmd.Parameters.Append .CreateParameter("UniqueKey", adVarChar, adParamInput, 20, keyaudit)

above worked as I had defined size of data type to 20 in sql and that was cause of it.

Thanks
 

Users who are viewing this thread

Top Bottom