Issue updating tables with always encrypted

Multi tool use
Multi tool use


Issue updating tables with always encrypted



I can insert new records into my tables with some columns encrypted (I use the always encrypted feature).
But... I can't update or delete rows.



Just an example: the tbUtenti table has the password column encrypted. The method works correctly in the insert, but not in the update.



The exception I got is (translation from italian language):



Cryptographic schema mismatch for columns / variables '@ p2', 'Password'. The encryption scheme for columns / variables is (encryption_type = 'RANDOMIZED', encryption_algorithm_name = 'AEAD_AES_256_CBC_HMAC_SHA_256', column_encryption_key_name = 'BISP_PK', column_encryption_key_database_name = 'DEVDB'), while the expression next to row '1' expects it to be ( encryption_type = 'DETERMINISTIC') (or lower).



My method is as follows:


public static bool SetUtente(tbUtenti ut){try
{
DBDesktopDataContext contesto = new DBDesktopDataContext(ConnectionString);
if (ut != null)
{
// update
tbUtenti utDB = contesto.tbUtentis.Where(u => u.Utente == ut.Utente).FirstOrDefault();
if (contesto.tbUtentis.Count() > 0 && utDB != null && utDB.Utente == ut.Utente)
{
utDB.AuthFacebook = ut.AuthFacebook;
utDB.AuthGoogle = ut.AuthGoogle;
utDB.IsAdmin = ut.IsAdmin;
utDB.Password = ut.Password;
contesto.SubmitChanges();
}
else
{
// insert new row (THIS WORKS!)
contesto.tbUtentis.InsertOnSubmit(ut);
contesto.SubmitChanges();
}
return true;
}
else
return false;
}
catch (Exception ex)
{ ...









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

fNu ZcZxOzyZaweahf78ylMAbqhV,Dq,4Qgxr7Fr,nTtaos,8nhT5
7lM8Ofgyrhv,v1 o H1fV ED wCGpm8KfHE

Popular posts from this blog

PHP contact form sending but not receiving emails

Do graphics cards have individual ID by which single devices can be distinguished?

Create weekly swift ios local notifications