title: Enterprise Library 6.0 Data Access issue with GetStoredProcCommand
body: <p>I am trying to build data access layer with Enterprise Library 6.0 Data block. below is my config file</p>
  
  <pre><code>&lt;configuration&gt;  
    &lt;configSections&gt;
      &lt;section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true"/&gt;
    &lt;/configSections&gt;
    &lt;dataConfiguration defaultDatabase="db"/&gt;
    &lt;connectionStrings&gt;
        &lt;add name="db" connectionString="..." providerName="System.Data.SqlClient" /&gt;
    &lt;/connectionStrings&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>and below is my class file</p>
  
  <pre><code>public class MasterRepo
  {
      Database db = null;
      static MasterRepo()
      {
          DatabaseFactory.SetDatabaseProviderFactory(new DatabaseProviderFactory());
      }
  
      public MasterRepo()
      {
          db = DatabaseFactory.CreateDatabase("db");
      }
  
      public int Save(int param1, int param2)
      {
          using (DbCommand cmd = db.GetStoredProcCommand("Save", param1, param2))
          {
              return cmd.ExecuteNonQuery();
          }
      }
  }
  </code></pre>
  
  <p>but we are getting <strong>error "ExecuteNonQuery: Connection property has not been initialized." at cmd.ExecuteNonQuery()</strong> <em>if we replace cmd.ExecuteNonQuery() with db.ExecuteNonQuery(cmd) then it works.</em></p>
  
  <p>so why it is failing in first place and what is good way of handling this?</p>