title: Linq - how to connect to a database?
body: <p>I have created a database with Microsoft SQL Server Management Studio (Microsoft SQL Server 2008).
  I've been searching around but either I don't understand it or can't find it, but how do I connect from within my project (Visual Studio 2010 Enterprise) so that I can send and receive data from the DB?
  My database name is MyDB.</p>
  
  <pre><code>var database = new MyDB();
  </code></pre>
  
  <p>In Solution Explorer, right-click References, and then click Add Reference.</p>
  
  <p>In the Add Reference dialog box, click .NET, click the System.Data.Linq assembly, and then click OK.</p>
  
  <p>The assembly is added to the project.</p>
  
  <p>Add the following directives at the top of Program.cs:</p>