Used console application and I have a problem on the app.config
file. By right, the code should be correct according to the various sources found in the Internet but my coding is not working for no reason. Anyone can advise me on this?
And the <configuration>
appears to be underlined with wriggly blue line, is it a warning or something? I dont know why it appears like this.
[EDITED]
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSetting></configSetting>
<connectionStrings>
<add name="Production"
providerName="System.Data.SqlClient"
connectionString="Data Source=EBSDLAB1SERVER2;Initial Catalog=Production;Integrated Security=True"/>
</connectionStrings>
</configuration>
The error shows, Unhandled Exception: System.Configuration.ConfigurationErrorException:Configuration system fail to initialize ---
System.Configuration.ConfigurationErrorException: Unrecognized configuration section connectionstring
Configuration system failed to initialize
In your App.Config
file you need a section for connection strings, it should look like:
<connectionStrings>
<clear />
<add name="Production"
providerName="System.Data.ProviderName"
connectionString="ConnectionStringGoesHere" />
</connectionStrings>
There's more information regarding this here.