title: SelectCommand.Connection property has not been initialized
body: <p>Alright, I'm having an issue with logic flow. For some reason one of the variables I'm declaring does not end up as existing in the current context. The error is on line 18:</p>
  
  <pre><code>Exception Details: System.InvalidOperationException: Fill: SelectCommand.Connection property has not been initialized.
  
  Source Error: 
  
  
  Line 16:            myAdapter.Fill(tabledata);
  Line 17:        } catch (Exception ex) {
  Line 18:            throw (ex);
  Line 19:        } finally {
  Line 20:            con.Close();
  </code></pre>
  
  <p>Here's the full page source:</p>
  
  <pre><code>&lt;% @Page Language="C#" Debug="true" %&gt;
  &lt;% @Import Namespace="System.Data" %&gt;
  &lt;% @Import Namespace="System.Data.Odbc" %&gt;
  &lt;% @Import Namespace="System.Web.Configuration" %&gt;
  &lt;!-- #include file="header.html" --&gt;
  &lt;%
      string conString = WebConfigurationManager.ConnectionStrings["stampConnectionString"].ConnectionString;
      OdbcDataAdapter myAdapter = new OdbcDataAdapter();  
      DataTable tabledata = new DataTable();      
      using (OdbcConnection con = new OdbcConnection(conString)) {
          using (OdbcCommand com = new OdbcCommand("SELECT * FROM cheeseisdelicious", con)) {
              myAdapter.SelectCommand = com;
          }
          try {
              con.Open();
              myAdapter.Fill(tabledata);
          } catch (Exception ex) {
              throw (ex);
          } finally {
              con.Close();
          }
      }
      Response.Write("&lt;table&gt;");
      foreach (DataRow row in tabledata.Rows) {
          Response.Write("&lt;tr&gt;");
          foreach (var item in row.ItemArray) {
              Response.Write("&lt;td&gt;" + item + "&lt;/td&gt;");
          }
          Response.Write("&lt;/tr&gt;");
      }
      Response.Write("&lt;/table&gt;");
  
  %&gt;
  &lt;!-- #include file="footer.html" --&gt;
  </code></pre>