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

Topics: Data Access Application Block
Sep 26, 2008 at 8:38 PM
Edited Sep 26, 2008 at 8:44 PM
Hi eveyone,

I get the below error

System.Configuration.ConfigurationErrorsException: The requested database ABC does not have provider name set in the connection string

I get the error at this line

Database db = DatabaseFactory.CreateDatabase("ABC");

I have connection string part at web.config

<connectionStrings>
    <remove name="LocalSqlServer" />
    <add name="ABC" connectionString="xxxxx" />
  </connectionStrings>


Code is running without any error at local. But, when i put the source to hosting, i get the above error.

What can i do for fixing this error?
Sep 26, 2008 at 9:42 PM
Edited Sep 26, 2008 at 9:42 PM
Did you edit the file manually or use the configuration tool?  The configuration tool should validate the configuration before saving it.  ** General Rule: Unless you know what are you doing, do not modify Enterprise Library configuration by hand! **

Your connection string element should look like (assuming your using SQL Server):

<add name="ABC" connectionString="xxxxx" providerName="System.Data.SqlClient" />

Phil

Sep 27, 2008 at 8:57 AM
I edit web.config file manuelly.

I added providerName, but nothing changed, already i get the same error

Do i have to install enterprise library to server, and edit the enterprise library configuration file?
I only added dll files to Bin folder and add configurations to web.config.


Sep 27, 2008 at 9:05 AM
Thanks Phill

I tried again, and adding providerName is solved the problem