Reputation: 103
I am just get in VB this two month and not really familiar with it. Hopefully can get advise here.
I am working on app.config and unable to figure out the way to update the app.config by retrieve the connection string from text file outside. When execute the program, the app.config should automatically retrieve the connection string from text file without required user to click on any button.
I have tried the way but it is not worked, app.config is not updated successfully:
<connectionStrings>
<add name="VMMPNP3.My.MySettings.VMMPNP3ConnectionString" connectionString=".\\connection.txt"
providerName="System.Data.SqlClient" />
</connectionStrings>
Connection string in the text file:
Data Source=ECSTSRD;Initial Catalog=VMMQT1;User ID=pnpuser;Password=pnpuser123
I have search through internet but I cannot found any article which similar with my situation.
Anyone do know what is the problem, please help and advise.
Thanks in advance.
Upvotes: 0
Views: 1538
Reputation: 7135
I could be wrong, but I don't believe referencing external files like that is supported.
If you want to keep your connection strings in a file separate to your app.config, you can do it using the configSource
attribute, as described here and in this question.
Upvotes: 1