title: Linq to SQL DataContext: how to load data?
body: <p>(I'm completely new to Linq to SQL) I am creating a web app that works very closely with a database, I'm looking for the quickest and connection time efficient model and believing Linq to SQL to be this. I'm using C#/.Net4/Visual Studio 2010</p>
  
  <p>For simplicity sake, I have a web .aspx page containing a number of asp Text Boxes. I want to give their Text values from SQL data via Linq to SQL object. I also have a file called DataClasses.dbml with a a table added in the design view. The code I have so far in my web page code-behind is:</p>
  
  <pre><code>DataClassesDataContext db = new DataClassesDataContext(getConnectionString);
  
  var table = from t in db.MyTable
              where t.PK == 2
              select new { t.col1, t.col2, t.col3};
  
  db.Connection.Open();
  db.  // What's the best way of loading the object?
  db.Connection.Close();
  </code></pre>
  
  <p>How do I then access the column values? Or do I databind it to a datatable? If so, how?</p>
  
  <pre><code>myTextBox1.Text = table.???col1.value;
  </code></pre>