Q:

Getting conflict error with the connection string in machine.config and app.config files

In my machine.config file I have a connection string as follows:
    <connectionStrings><add name="sqlAppConn" connectionString="Data Source=CTDISP-SVN;Initial Catalog=netlic;User ID=admina;Password=password1;" providerName="System.Data.SqlClient" /></connectionStrings>

I created a c# console application which also uses a connection string with the same name in its App.config file, but its pointing to a different database. The connection string in there is:
    <connectionStrings><add name="sqlAppConn" connectionString="Data Source=CTDISP-SVN;Initial Catalog=aspnetdb;User ID=adminb;Password=password2;" providerName="System.Data.SqlClient" /></connectionStrings>

When I run the program I get an error saying that there is a conflict with the connection strings.  But I thought it would be fine because it will overwrite the connection string in my machine.config file.
However I am still getting the error? why?... 

A:

According to the site 
https://docs.microsoft.com/en-us/dotnet/framework/data/adonet/connection-strings-and-configuration-files

Connection strings can be stored as key/value pairs in the connectionStrings section of the configuration element of an application configuration file. Child elements include add, clear, and remove.

Putting <clear /> in your app config before the add entry should do the trick.

