How to generate and save Connection string in Visual Studio
Writing connection string manually is one of the worst things in software development. That's why I always want them to be generated by any tool but not by me. Some times before I have found a way how to generate a connection string creating an .udl file in Windows (http://markimarta.com/c/how-easily-write-the-text-of-connection-string/). Now I've found a better way.
This method allows to generate connection string and save it to web.config file directly.
So press Alt+Enter or right click on your Project and choose Properties, in the opened windows go to tab "Settings" (Figure 1).
Now you need to fill the new setting. Click on the field in column "Name" and enter the name of variable. In the column "Type" choose "Connection string". In the right side of "Value" column you can see the button with "…". Click on it and Connection Properties window will be opened (Figure 2).
Save changes, press Ctrl+S.
Now when you open Web.config in your project, you will find the new element in connectionStirngs node (Figure 3). So you can rename it of you want and use in your project.
No Comments »
No comments yet.
RSS feed for comments on this post. TrackBack URL