Hi Friends,
I have an application which uses another project for data libraries. Those libraries are common and can be used in other projects as well, So I do not want to initialize the connection string in Web.config of the main web application.
I tried it saving in App.Config file of the library project, but when I am trying to use it, it is giving me an error. I am always getting that value as NULL.
Here is how I am trying to fetch the connection string from App.Config:
public static string CONNECTING_STRING = ConfigurationManager.ConnectionStrings["dbSql"].ConnectionString;
And here is my App.Config file
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<connectionStrings>
<add name="dbSql" connectionString="Data Source=dbserver;Initial Catalog=TestDB;User ID=test;Password=test123;" />
</connectionStrings>
<appSettings>
<add key="DefaultConnection" value="dbSql" />
</appSettings>
</configuration>
Can anyone help me getting that issue?
Thanks in advance..