<connectionStrings>
<add name="mycollegeproject" connectionString="Data Source=mssql2.gear.host;Initial Catalog=mycollegeproject;Persist Security Info=True;User ID=mycollegeproject;Password=*******" />
</connectionStrings>
public static string strcon = ConfigurationManager.ConnectionStrings["mycollegeproject"].ConnectionString;
And the error
System.NullReferenceException: Object reference not set to an instance of an object.