I have a class library that has app.config I placed my connection string there as follows:
<configuration>
<configSections>
<section name="dataConfiguration"
type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data"
requirePermission="true"/>
</configSections>
<connectionStrings>
<clear />
<add name="Acquisition" connectionString="Data Source=104.130.90.244;Initial Catalog=Hub;Persist Security Info=True;User ID=webApp;Password=webApp" providerName="System.Data.SqlClient"/>
</connectionStrings>
in my method I call the connection string as:
private const string connectionName = "Acquisition";
string myConnection = ConfigurationManager.ConnectionStrings[connectionName].ToStr ...
Go to the complete details ...