Unregcognize 'ProviderMapping'

Jul 5, 2011 at 3:27 AM

I have the code in web config , the code show below

 <configSections>
    <section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
 </configSections>

  <dataConfiguration defaultDatabase="ConnectionString" >
    <ProviderMappings>
      <add name = "MySql.Data.MySqlClient" databaseType="EntLibContrib.Data.MySql.MySqlDatabase, EntLibContrib.Data.MySql, Version=4.1.0.0, Culture=neutral, PublicKeyToken=null" />
    </ProviderMappings >
  </dataConfiguration >

<connectionStrings>
    <add name="ConnectionString" connectionString="Database=broadcastsystem;server=localhost;Uid=root;Pwd=123456;" providerName="MySql.Data.MySqlClient"/>
  </connectionStrings>

 

The page that I want to call connection string

Imports Microsoft.Practices.EnterpriseLibrary.Data
Imports EntLibContrib.Data.MySql
Imports EntLibContrib.Data.MySql.Properties
Imports MySql.Data.MySqlClient
Imports System.Data

strSql = "SELECT * FROM tblAdmin Where LoginId = """ + strLoginId + """ AND LogPwd = """ + strLogPwd + """ "
strSql += "AND Status= ""A"" "

        objDB = DatabaseFactory.CreateDatabase("ConnectionString")
        objDS = objDB.ExecuteDataSet(CommandType.Text, strSql)

        If objDS.Tables(0).Rows.Count > 0 Then
            Dim str As String = "haha"
        End If