Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: Professional VB 2005 ISBN: 0-7645-7536-8
This is the forum to discuss the Wrox book Professional VB 2005 by Bill Evjen, Billy Hollis, Rockford Lhotka, Tim McCarthy, Rama Ramachandran, Kent Sharkey, Bill Sheldon; ISBN: 9780764575365
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional VB 2005 ISBN: 0-7645-7536-8 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old October 9th, 2006, 03:56 AM
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()
    Try

        Dim customSection As CustomSection

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

        customSection = _
        config.GetSection("CustomSection")
        Console.WriteLine( _
        "Section name: {0}", _
        customSection.SectionInformation.Name)

    Catch err As ConfigurationErrorsException
        Console.WriteLine(err.ToString())
    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?


Similar Threads
Thread Thread Starter Forum Replies Last Post
Where is source code for Chapter 11? benethridge BOOK: Professional Java Development with the Spring Framework 1 September 5th, 2006 08:58 PM
Chapter 11 Code Problems vbswshare BOOK: Professional VB 2005 ISBN: 0-7645-7536-8 3 April 9th, 2006 08:39 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.