Operand type clash: varchar is incompatible with varchar(50) trying to insert in encrypted database

后端 未结 3 900
有刺的猬
有刺的猬 2020-12-10 08:30

I am getting a SqlException:

Operand type clash: varchar is incompatible with varchar(50) encrypted with (encryption_type = \'DETERMINI

3条回答
  •  难免孤独
    2020-12-10 09:07

    There are 2 things you can try,

    Ensure that Column encryption setting is enabled in your connection string. This can be done using a SqlConnectionStringBuilder object and setting SqlConnectionStringBuilder.ColumnEncryptionSetting to Enabled as follows

    strbldr.ColumnEncryptionSetting = SqlConnectionColumnEncryptionSetting.Enabled;
    

    If your stored procedure was created before you encrypted your column, you will need to refresh metadata for your stored procedure as follows

    Use [Database]
    GO    
    --Do this for all stored procedures
    EXEC sys.sp_refresh_parameter_encryption @name = '[dbo].[Clients_Insert]'
    

提交回复
热议问题