i am trying to get connection string from method resulting error object reference not set to the instance object my method is,
this method return connection,
namespace InspectionServices.Services
{
public class ConfigManager
{
public static string GetConnectionString()
{
return ConfigurationManager.ConnectionStrings["***"].ConnectionString;
}
}
}
and here i am getting connection by calling method mentioned above,
string connectionString = InspectionServices.Services.ConfigManager.GetConnectionString();
hopes for your suggestion
Thanks in Advance
EDITED:
Appconfig,
<connectionStrings>
<add name="Inspection" connectionString="Data Source=***;Database=***;Integrated Security=SSPI; Persist Security Info=false; Trusted_Connection=Yes;" providerName="System.Data.SqlClient"/>
</connectionStrings>