locked
web.config file connectionstring retrieval error as not declared RRS feed

  • Question

  • Hi I cannot figure out the follwing issue.

    Anu suggestions will be greatly apriciated.

    Thank you.

    : error BC30451: 'myConnectionString' is not declared. It may be inaccessible due to its protection level.

    In my default.aspx.vb I am trying to retrieve it in that way.

    Dim myCmmander As New NpgsqlCommand(myQuery, ConfigurationManager.ConnectionStrings(gogiConnection))

    in my web.config looks like that

    
    
    
    
    
    

    <?xml version="1.0"?> <configuration> <configSections> <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/> <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere" /> <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" /> <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" /> <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" /> </sectionGroup> </sectionGroup> </sectionGroup> </configSections> <appSettings/> <connectionStrings> <add name="myConnectionString" connectionString="Server=127.0.0.1;Port=5432;Database=postgres;User Id=postgres;Password=password" providerName="Npgsql"/> </connectionStrings> <system.web>

    Saturday, August 25, 2012 11:17 PM

All replies

  • try

    ConfigurationManager.ConnectionStrings(gogiConnection).ConnectionString


    I'd rather live with false hope than with false despair.

    Wednesday, September 19, 2012 10:00 PM