HighTechTalks DotNet Forums  

appconfig

Dotnet Framework microsoft.public.dotnet.framework


Discuss appconfig in the Dotnet Framework forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Teemu Keiski
 
Posts: n/a

Default Re: appconfig - 04-25-2004 , 12:17 PM






Hi,

first of all: *.config files are case.sensitive and second: to add key/value
settings, you'd use <add> element.

Your config should be:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="connectionstring"
value="server=(local);Trusted_Connection=yes;datab ase=Northwind" />
</appSettings>
</configuration>

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
http://blogs.aspadvice.com/joteke


"David Mercer" <fmercer (AT) blueyonder (DOT) co.uk> wrote

I have no idea why I get error message

An unhandled exception of type
'System.Configuration.ConfigurationException' occured in system.dll

Additional information: Unrecognised configuration section AppSettings

Here is the App.Config files details

<?xml version="1.0" encoding="utf-8" ?>

<configuration>

<AppSettings>

<Key="connectionstring" value="server=(local);Trusted_Connection=yes;
database=Northwind"/>

</AppSettings>

</configuration>



and all i want to do is to shoe the value of the connectiostring in a
message box in the form load event, as below.

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

MsgBox(System.Configuration.ConfigurationSettings. AppSettings.Get("connectio
nstring"))

End Sub



Surely its not that difficult to spot what I am doing wrong I have copied
and recopied this out time and time again but still cannot read the key
value in the event????



David




Reply With Quote
  #2  
Old   
Cowboy \(Gregory A. Beamer\)
 
Posts: n/a

Default Re: appconfig - 04-26-2004 , 10:48 AM






<add key="connectionstring" value="" />

That is first. I think you can also simplify the Get() like so (works in
C#):

MsgBox(System.Configuration.ConfigurationSettings. AppSettings("connectionstr
ing")

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

************************************************** ********************
Think Outside the Box!
************************************************** ********************
"David Mercer" <fmercer (AT) blueyonder (DOT) co.uk> wrote

Quote:
I have no idea why I get error message

An unhandled exception of type
'System.Configuration.ConfigurationException' occured in system.dll

Additional information: Unrecognised configuration section AppSettings

Here is the App.Config files details

?xml version="1.0" encoding="utf-8" ?

configuration

AppSettings

Key="connectionstring" value="server=(local);Trusted_Connection=yes;
database=Northwind"/

/AppSettings

/configuration



and all i want to do is to shoe the value of the connectiostring in a
message box in the form load event, as below.

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load


MsgBox(System.Configuration.ConfigurationSettings. AppSettings.Get("connectio
nstring"))

End Sub



Surely its not that difficult to spot what I am doing wrong I have copied
and recopied this out time and time again but still cannot read the key
value in the event????



David





Reply With Quote
  #3  
Old   
Bob Powell [MVP]
 
Posts: n/a

Default Re: appconfig - 04-28-2004 , 08:16 AM



David,

Your clock settings are wrong. Please correct it.

--
Bob Powell [MVP]
Visual C#, System.Drawing

All you ever wanted to know about ListView custom drawing is in Well Formed.
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

*RSS*RSS*RSS*RSS*RSS*RSS*RSS*RSS*RSS*RSS*RSS*RSS*R SS*

The GDI+ FAQ: http://www.bobpowell.net/faqfeed.xml
Windows Forms Tips and Tricks: http://www.bobpowell.net/tipstricks.xml
Bob's Blog: http://royo.is-a-geek.com/siteFeeder...aspx?FeedId=41

*RSS*RSS*RSS*RSS*RSS*RSS*RSS*RSS*RSS*RSS*RSS*RSS*R SS*





"David Mercer" <fmercer (AT) blueyonder (DOT) co.uk> wrote

Quote:
I have no idea why I get error message

An unhandled exception of type
'System.Configuration.ConfigurationException' occured in system.dll

Additional information: Unrecognised configuration section AppSettings

Here is the App.Config files details

?xml version="1.0" encoding="utf-8" ?

configuration

AppSettings

Key="connectionstring" value="server=(local);Trusted_Connection=yes;
database=Northwind"/

/AppSettings

/configuration



and all i want to do is to shoe the value of the connectiostring in a
message box in the form load event, as below.

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load


MsgBox(System.Configuration.ConfigurationSettings. AppSettings.Get("connectio
nstring"))

End Sub



Surely its not that difficult to spot what I am doing wrong I have copied
and recopied this out time and time again but still cannot read the key
value in the event????



David





Reply With Quote
  #4  
Old   
David Mercer
 
Posts: n/a

Default appconfig - 05-25-2004 , 11:13 AM



I have no idea why I get error message

An unhandled exception of type
'System.Configuration.ConfigurationException' occured in system.dll

Additional information: Unrecognised configuration section AppSettings

Here is the App.Config files details

<?xml version="1.0" encoding="utf-8" ?>

<configuration>

<AppSettings>

<Key="connectionstring" value="server=(local);Trusted_Connection=yes;
database=Northwind"/>

</AppSettings>

</configuration>



and all i want to do is to shoe the value of the connectiostring in a
message box in the form load event, as below.

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

MsgBox(System.Configuration.ConfigurationSettings. AppSettings.Get("connectio
nstring"))

End Sub



Surely its not that difficult to spot what I am doing wrong I have copied
and recopied this out time and time again but still cannot read the key
value in the event????



David



Reply With Quote
  #5  
Old   
babybinta1
 
Posts: n/a

Default RE: appconfig - 11-27-2007 , 09:36 AM



Just to Re-Intrduce myself and to acquaint myself more with you. I was the one who met you at the First Aid training program at the Palm Beach together with Jerry. I am on this Email address incase you want to communicate me. I have gone through your programs and i am impressed with many of it.

From http://search.yahoo.com/search?p=BOB...p=mss&ei=UTF-8

Posted via DevelopmentNow.com Groups
http://www.developmentnow.com

Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.