AppendParameter and type mismatch value

DevAccess

Registered User.
Local time
Yesterday, 20:27
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.
 
What is the datatype of keyaudit. If numeric use adVarNumeric
 
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

Back
Top Bottom