laconicdev
laconicdev

Reputation: 6440

Problems with VS2012 SQL CLR and LINQ

We are beginning to use VS2012 for our solution. One of the projects is SQL CLR. When I try to compile it, I get the following error:

CS0234: The type or namespace name 'Linq' does not exist in the namespace 'System' (are you missing an assembly reference?)

However, the same code compiles fine in VS2010. The project has a reference to the System.dll. What could be going on? Thanks.

Upvotes: 0

Views: 3514

Answers (1)

Gonzalo Contento
Gonzalo Contento

Reputation: 857

Please refer to:

You need to add a reference to System.Core.dll (Use .NET 3.5 for MS-SQL 2008):

// ...    
using System.Linq;

    public partial class StoredProcedures
    {
        [SqlProcedure]
        public static void MyProcedure()
        {
            // ...
            List<string> list = new List<string>();
            var result = list.Where(x => x == "string");
            // ...
        }
    }

Upvotes: 2

Related Questions