我在SQL中创建程序集,但它给出了错误。那么如何解决呢。给出一些想法。 [英] I am creating assembly in SQL but it is giving error. So how to solve it. Gives some idea.

查看:128
本文介绍了我在SQL中创建程序集,但它给出了错误。那么如何解决呢。给出一些想法。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从'C:\ Users \ ....... \Projects\CLRDemo \CLRDemo \bin \Debug \CLRDemo.dll'FRE CREATE ASSEMBLY CLRDemo PERMISSION_SET =安全; 





我使用此代码在sql中创建程序集。



但是它给出了这个错误。

程序集'CLRDemo'引用程序集'system.runtime.serialization,version = 4.0.0.0,culture = neutral,publickeytoken = b77a5c561934e089 。',这在当前数据库中不存在。 SQL Server尝试从引用程序集来自的相同位置定位并自动加载引用的程序集,但该操作失败(原因:2(系统找不到指定的文件。))。请将引用的程序集加载到当前数据库中并重试您的请求。





我尝试过:



没试过,因为在我创建之前我已经放弃了那个程序集。之后我想创建但它给我错误。

解决方案

你需要在数据库中注册缺少的程序集,就像错误说的那样。可以在 c# - Sql Server CLR加载程序集失败的答案#2中找到一个很好的解释 - 堆栈溢出 [ ^

CREATE ASSEMBLY CLRDemo FROM 'C:\Users\.......\Projects\CLRDemo\CLRDemo\bin\Debug\CLRDemo.dll' WITH PERMISSION_SET = SAFE;



I use this code to create assembly in sql.

But it is giving this error.

Assembly 'CLRDemo' references assembly 'system.runtime.serialization, version=4.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089.', which is not present in the current database. SQL Server attempted to locate and automatically load the referenced assembly from the same location where referring assembly came from, but that operation has failed (reason: 2(The system cannot find the file specified.)). Please load the referenced assembly into the current database and retry your request.



What I have tried:

Not tried , because before it i have create but i drop that assembly. After that i want to create but it is giving error to me.

解决方案

You need to register the missing assembly in the database as well, just like the error says. A good explanation can be found in Answer #2 at c# - Sql Server CLR load assembly failed - Stack Overflow[^]


这篇关于我在SQL中创建程序集,但它给出了错误。那么如何解决呢。给出一些想法。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆