View Single Post
  #1 (permalink)  
Old October 9th, 2006, 03:56 AM
ablinco ablinco is offline
Registered User
Join Date: Oct 2006
Location: Brisbane, Queensland, Australia.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 11 Code Examples

The following line in the GetPubsConnection function in the AdoNetFeaturesTest project is being flagged as obsolete.

ConfigurationSettings.AppSettings("dbConnectionStr ing")

I have checked the Online Help which indeed advises that:

This method is deprecated and is maintained for backward compatibility. Please use the GetSection method instead

Looking for GetSection in the help returns some code examples on its usage:

' Get a custom section.
Shared Sub GetSection()

        Dim customSection As CustomSection

        ' Get the current configuration file.
        Dim config _
        As System.Configuration.Configuration = _
        ConfigurationManager.OpenExeConfiguration( _

        customSection = _
        Console.WriteLine( _
        "Section name: {0}", _

    Catch err As ConfigurationErrorsException
    End Try

End Sub 'GetSection

This code does not seem to work for me, I get the following error - Type 'CustomeSection' is not defined.

Can anyone show how to return the connection string using GetSection?