Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot find using System.Data.Linq

Tags:

I'm using C#, EF 4 in asp.net 4 and VS 2010.

I'm trying to load namespace System.Data.Linq with this code using System.Data.Linq and I receive this error:

Error 2 The type or namespace name 'Linq' does not exist in the namespace 'System.Data' (are you missing an assembly reference?)

Any idea what I'm doing wrong.

like image 690
GibboK Avatar asked Jul 20 '11 06:07

GibboK


People also ask

How to add System data linq?

Right click your solution/project. Click Add Reference and search for System. Data. Linq and add the reference there and it should compile.

What is DataContext C#?

The DataContext is the source of all entities mapped over a database connection. It tracks changes that you made to all retrieved entities and maintains an "identity cache" that guarantees that entities retrieved more than one time are represented by using the same object instance.

What is Linq SQL in asp net?

LINQ to SQL is a component of . NET Framework version 3.5 that provides a run-time infrastructure for managing relational data as objects. Relational data appears as a collection of two-dimensional tables (relations or flat files), where common columns relate tables to each other.


2 Answers

Right click your solution/project. Click Add Reference and search for System.Data.Linq and add the reference there and it should compile.

like image 74
Jesus Ramos Avatar answered Sep 19 '22 19:09

Jesus Ramos


Just to confirm that Adding the reference to the project didn't work for me because it was already selected.

However, selecting "Copy Local, True" in the Properties pane for the reference made it start working.

like image 41
Steve Woods Avatar answered Sep 20 '22 19:09

Steve Woods