step 1
Just go to the "Properties" node then double-click on "Settings.Settings". You will then get a grid with columns for Name, Type, Scope and Value as in the following:
Schritt 2
Now, specify a name, then click in the Type cell. In the drop-down box choose "Connection String". Then set the Scope to "Application".
Step 3
Then click in the value cell and an ellipsis ("...") will appear in the right. Click on the ellipsis and create the connection string.
dann in dem Programm, den Zugang (USE) der connecti Ein String mit: Properties.Setting.Default. (Name) Dabei steht (Name) für den Namen, den Sie in der Namensspalte angegeben haben.
Example
In this example, we will display a record in a DataGridView on a button click.
Coding
Form1.cs[Design]
Form1.cs
[![enter image description here][5]][5]
App.config
You see that the Connection String is automatically included..
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
</configSections>
<connectionStrings>
<add name="ConnectionString.Properties.Settings.connection" connectionString="Data Source=MCNDESKTOP43;Initial Catalog=EmpDetail;Persist Security Info=True;User ID=sa;Password=*****"
providerName="System.Data.SqlClient" />
</connectionStrings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>
Output
[![enter image description here][5]][5]
[1]: http://i.stack.imgur.com/hyNXF.jpg
[2]: http://i.stack.imgur.com/4BJ5a.jpg
[3]: http://i.stack.imgur.com/F3ViL.jpg
[4]: http://i.stack.imgur.com/oGC5a.jpg
[5]: http://i.stack.imgur.com/OZO22.jpg
was über den Code in der 'App, config' Datei setzen? Oder willst du es weiter weg vom Code? –