title: How to use microsoft enterprise library in asp.net c# application for MySQL
body: <p>I am use Database MySQL in ASP.NET c# application.When I use simple Steps for connect the MySQL database and create ADO.NET connections working fine. But I want to use Microsoft Enterprise Library for my application.I added Reference given below</p>
  
  <ol>
  <li>Microsoft.Practices.EnterpriseLibrary.Common</li>
  <li>Microsoft.Practices.EnterpriseLibrary.Data</li>
  <li>Microsoft.Practices.EnterpriseLibrary.Data.S</li>
  <li>MySql.Data</li>
  <li>MySql.Web</li>
  </ol>
  
  <p>Below is my web.comfig code</p>
  
  <pre><code>&lt;system.data&gt;
    &lt;DbProviderFactories&gt;
      &lt;remove invariant="MySql.Data.MySqlClient" /&gt;
      &lt;add name="MySQL Data Provider"
        invariant="MySql.Data.MySqlClient"
        description=".Net Framework Data Provider for MySQL"
        type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.4.6.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" /&gt;
    &lt;/DbProviderFactories&gt;
  &lt;/system.data&gt;
  &lt;dataConfiguration defaultDatabase="db1"&gt;&lt;/dataConfiguration&gt;
  &lt;connectionStrings&gt;  
    &lt;add name="constr" connectionString="Server=localhost;Database=db1;user id=test;persistsecurityinfo=True;" providerName="MySql.Data.MySqlClient;"/&gt;
  &lt;/connectionStrings&gt;
  &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="false" /&gt;
    &lt;/configSections&gt;
  </code></pre>
  
  <p>and when I use in code by below code</p>
  
  <pre><code>if (_connectionMode == DatabaseConnectionMode.UseConnectionStringName)
  {
     _Database = new DatabaseProviderFactory().Create(_dbConnectionString) as Database;
  }
  </code></pre>
  
  <p>here throw the below error</p>
  
  <blockquote>
    <p>The requested database db1does not have a valid ADO.NET provider name set in the connection string.</p>
  </blockquote>
  
  <p>Give me proper solution with reason why this happening.</p>