Please see the code below:
Public Shared Sub SyncConnectionStrings()
Dim strCon As String
Dim tyDatabase As typeDatabase
Dim boolConfigChanged As Boolean
'Dim config As System.Configuration.Configuration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None)
Dim config As Configuration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None)
Dim strConnectionString As ConnectionStringSettings
For Each strConnectionString In ConfigurationManager.ConnectionStrings
'More code here, but irrelevant for this question.
Next
End Sub
The code loops through all the connection strings in the app.config file. There are three connection strings in the app.config
, but four connection strings are found. Where is: LocalSqlServer (this is the ConfigurationManager.ConnectionStrings.Name
) defined?
It is defined in the Machine.config global file located at
"C:\Windows\Microsoft.NET\Framework\v4.0.30319\CONFIG".
It is generated when you install the NET.Framework and is needed by tools that work on the ASPNETDB
If you don't need it, you could try to add this to your app.config
<connectionStrings>
<clear/>
.....
or also
<connectionStrings>
<remove name="LocalSqlServer" />
I really suggest to not change anything in Machine.Config unless you know the side effects.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With