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;
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.
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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With