|
-
Sep 6th, 2004, 03:42 PM
#1
Thread Starter
Lively Member
configSections in App.config confusion
I am trying to create custom sections in the App.config file and read in the values at runtime but it is really confusing me.
If i have something like....
Code:
<configSections>
<section name="connectionProfiles" type="? What Goes Here ?" />
</configSections>
<connectionProfiles>
<connectionProfile name="Profile1" value="MyValue" />
<connectionProfile name="Profile2" value="AnotherValue" />
.......
</connectionProfiles>
How do i then load those values at runtime into my application. Any help will be greatly appreciated.
-
Sep 8th, 2004, 12:00 AM
#2
In web.config:
Code:
<configuration>
<configSections>
<section name="db" type="System.Configuration.NameValueFileSectionHandler, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
</configSections>
<db>
<add key="ConnectionString" value="Data Source=(local);Initial Catalog=Northwind;Integrated Security=SSPI" />
<add key="SQLStatement" value="SELECT TOP 10 * FROM Orders;" />
</db>
To access it:
VB Code:
strVariableName = System.Configuration.ConfigurationSettings.GetConfig("db")("ConnectionString").ToString
Comprende vouz?
-
Sep 8th, 2004, 12:26 AM
#3
Where the F* did "PublicKeyToken" come from? Does it matter what the value is? And if it does, how does one come up with it?
Tg
-
Sep 8th, 2004, 12:36 AM
#4
Originally posted by techgnome
Where the F* did "PublicKeyToken" come from? Does it matter what the value is? And if it does, how does one come up with it?
Tg
I don't have a F*ing clue! I had asked this question in this forum earlier, I got no answer. I had to rely on tidbits. 
Maybe someone can explain it to me as well. I'd really welcome that.
-
Sep 8th, 2004, 12:40 AM
#5
Originally posted by mendhak
I don't have a F*ing clue! I had asked this question in this forum earlier, I got no answer. I had to rely on tidbits. 
Maybe someone can explain it to me as well. I'd really welcome that.
Sorry mate, I thought maybe you knew something I didn't. sounds like the perfect time to fire up a .NETapp and see what falls out!
TG
-
Sep 8th, 2004, 12:54 AM
#6
Check to see if there's a difference in ASP.NET and VB.NET regarding the way it works.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|