In this article I will explain with an example, how to resolve the following error in ASP.Net.
The ConnectionString property has not been initialized.
 
 
Error
The following error occurs when ConnectionString property of SqlConnection object is not set or it is invalid.
Server Error in '/.Net' Application.

The ConnectionString property has not been initialized.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: The ConnectionString property has not been initialized.
 
 
Solution
The solution to this problem is to make sure following things are correct:
1. Check if you are assigning value to SqlConnection object or not.
2. If connection string is coming from web.config check the key name is correct.
Note: For more details on how to read Connection String from Web.Config file, please refer my article Read or Write Connection Strings in Web.Config file using ASP.Net using C# and VB.Net.
 
3. The variable name should be unique.