在SQL CLR UDF中使用System.Linq程序集

编程入门 行业动态 更新时间:2024-10-08 13:37:57
本文介绍了在SQL CLR UDF中使用System.Linq程序集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在Visual Studio 2010中使用SQL UDF项目类型在C#中创建SQL Server用户定义函数.我的代码中有一个简单的Linq字符串操作表达式(myString.Where()),由于我生成了一个错误,没有使用 System.Linq 名称空间.如果我添加

I am creating a SQL Server user-defined function in C# using the SQL UDF project type in Visual Studio 2010. I have a simple Linq string manipulation expression (myString.Where()) in my code that generates an error because I'm not using the System.Linq namespace. If I add

using System.Linq;

在我的.cs文件中,出现一个错误,问我是否缺少程序集引用.如果然后我在解决方案资源管理器中右键单击该项目,然后选择添加引用",则.NET选项卡中没有列出 System.Linq 组件.

to my .cs file, I get an error asking me if I'm missing an assembly reference. If I then right-click the project in Solution Explorer, and select "Add Reference", there is no System.Linq component listed in the .NET tab.

我想我可以浏览硬盘驱动器中的适当程序集DLL,但是Visual Studio为什么不知道它呢?在SQL CLR代码中使用Linq有一些限制吗?

I suppose I could go browsing the hard drive for the appropriate assembly DLL, but why doesn't Visual Studio know about it? Is there some restriction about using Linq in SQL CLR code?

推荐答案

好吧,显然,在项目中添加对System.Core.DLL的引用将允许"using System.Linq"语句在SQL CLR项目中进行编译.走吧.

Okay, apparently adding a reference to System.Core.DLL to the project will allow the "using System.Linq" statement to compile in a SQL CLR project. Go figure.

更多推荐

在SQL CLR UDF中使用System.Linq程序集

本文发布于:2023-11-13 11:25:03,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1584231.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:程序   CLR   SQL   UDF   Linq

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!