Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试使用具有加密数据的存储过程,我已经成功地用 Python 编写了相同的程序。但是,当我使用 c# 连接到同一个数据库时,它会引发此错误。找不到对称密钥“keyFieldProtection”,因为它不存在或您没有权限。
您需要授予密钥权限。如果您无法授予权限,则需要将模式切换为 windows 身份验证。
否则,如果您要打开主密钥,请参阅以下内容:
https://docs.microsoft.com/en-us/sql/t-sql/statements/open-master-key-transact-sql?redirectedfrom=MSDN&view=sql-server-2017
如上所述;
“如果数据库主密钥是用服务主密钥加密的,它会在需要解密或加密时自动打开。在这种情况下,没有必要使用 OPEN MASTER KEY 语句。”</p>
不看你的代码很难说