Accessing the app.config...
-
This is some old code I wrote...old as in 2 days old :doh:
XmlDocument config = new XmlDocument();
config.LoadXml(new StreamReader(Application.ExecutablePath + ".config").ReadToEnd());
string connection = config.ChildNodes[1].ChildNodes[1].ChildNodes[0].Attributes["connectionString"].InnerText;I dunno, app.config seems to hate me. No matter what I try, no matter how many tutorials I read, it never works.
-
This is some old code I wrote...old as in 2 days old :doh:
XmlDocument config = new XmlDocument();
config.LoadXml(new StreamReader(Application.ExecutablePath + ".config").ReadToEnd());
string connection = config.ChildNodes[1].ChildNodes[1].ChildNodes[0].Attributes["connectionString"].InnerText;I dunno, app.config seems to hate me. No matter what I try, no matter how many tutorials I read, it never works.
Post this in the correct forum and I can help (hint: namespaces) But in the meantime PLEASE do some checks on return values in each step. My eyes are watering just looking at it.
cheers, Chris Maunder
CodeProject.com : C++ MVP
-
This is some old code I wrote...old as in 2 days old :doh:
XmlDocument config = new XmlDocument();
config.LoadXml(new StreamReader(Application.ExecutablePath + ".config").ReadToEnd());
string connection = config.ChildNodes[1].ChildNodes[1].ChildNodes[0].Attributes["connectionString"].InnerText;I dunno, app.config seems to hate me. No matter what I try, no matter how many tutorials I read, it never works.
Roll your own.
-
Post this in the correct forum and I can help (hint: namespaces) But in the meantime PLEASE do some checks on return values in each step. My eyes are watering just looking at it.
cheers, Chris Maunder
CodeProject.com : C++ MVP
i am new to this message board
-
i am new to this message board
1
-
2
-
i am new to this message board
And spam is the best way to get started :doh: (note the irony)
Greetings. -------- M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you “The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson Rating helpfull answers is nice, but saying thanks can be even nicer.
-
Roll your own.
:)
But fortunately we have the nanny-state politicians who can step in to protect us poor stupid consumers, most of whom would not know a JVM from a frozen chicken. Bruce Pierson
Because programming is an art, not a science. Marc Clifton
I gave up when I couldn't spell "egg". Justine Allen -
i am new to this message board
That doesn't forgive you the responsibility of becoming familiar with the rules before you start posting.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
-----
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001