Pages

Showing posts with label The requested database databasename does not have provider name set in the connection string. Show all posts
Showing posts with label The requested database databasename does not have provider name set in the connection string. Show all posts

Monday, November 28, 2011

The requested database does not have provider name set in the connection string

Hello Friends

I came across with an error when I was trying to connect to SQL Database by using Microsoft.Practices.EnterpriseLibrary.Data

It throws below error every time.
“The requested database <databasename> does not have provider name set in the connection string."

Then I checked the connection string in web.config file of SharePoint WebApplication and I found that this parameter is missing “providerName="System.Data.SqlClient" in the <ConnectionString> tag.

Old Connection string:
<connectionStrings>
    <add connectionString="Server=servername;Database=dbname;User ID=userid;Password=password" name="MyConnectionstring" />
      </connectionStrings>
Changed Connection String Add the Provider name:
<connectionStrings>
    <add connectionString="Server=servername;Database=dbname;User ID=userid;Password=password" name="MyConnectionstring" providerName="System.Data.SqlClient"
 />
      </connectionStrings>

Enjoy!!