Explanation:
The error occur when you keep your database connection string in Config file, and when you are retrieving your connection from Config file, you are usingstring str = System.Configuration.ConfigurationManager.
But it shows the error
Solution:
Just go to Solution Explorer in your visual studio and right click on Reference and select add reference, in the new window select System.Configuration and click Ok.Your Problem Solved!