T
Tony Johansson
Hi!
Here I have an example of a program that is using the app.config file that
is listed at the bottom.
The problem is that when I run this program I get an execption which is in
swedish but it say something like
"It occured an error when the sectionhandling for
MyFirstSectiongroup/MyFirstSection should be created. It not
possible to read the file or the composition ConnectionStringDemo or one of
its dependences."
Does anyone have any suggestion where to change ?
static void Main(string[] args)
{
try
{
Object o =
ConfigurationManager.GetSection("MyFirstSectionGroup/MyFirstSection");
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="MyFirstSectionGroup">
<section name="MyFirstSection"
type="ConnectionStringDemo.MyFirstSectionHandler,ConnectionStringDemo"/>
</sectionGroup>
</configSections>
<MyFirstSectionGroup>
<MyFirstSection>
<Value>
<Identifier>111</Identifier>
<SettingValue>System.Data.SqlClient</SettingValue>
</Value>
<Value>
<Identifier>112</Identifier>
<SettingValue>System.Data.OleDb</SettingValue>
</Value>
<Value>
<Identifier>113</Identifier>
<SettingValue>System.Data.Odbc</SettingValue>
</Value>
</MyFirstSection>
</MyFirstSectionGroup>
</configuration>
//Tony
Here I have an example of a program that is using the app.config file that
is listed at the bottom.
The problem is that when I run this program I get an execption which is in
swedish but it say something like
"It occured an error when the sectionhandling for
MyFirstSectiongroup/MyFirstSection should be created. It not
possible to read the file or the composition ConnectionStringDemo or one of
its dependences."
Does anyone have any suggestion where to change ?
static void Main(string[] args)
{
try
{
Object o =
ConfigurationManager.GetSection("MyFirstSectionGroup/MyFirstSection");
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="MyFirstSectionGroup">
<section name="MyFirstSection"
type="ConnectionStringDemo.MyFirstSectionHandler,ConnectionStringDemo"/>
</sectionGroup>
</configSections>
<MyFirstSectionGroup>
<MyFirstSection>
<Value>
<Identifier>111</Identifier>
<SettingValue>System.Data.SqlClient</SettingValue>
</Value>
<Value>
<Identifier>112</Identifier>
<SettingValue>System.Data.OleDb</SettingValue>
</Value>
<Value>
<Identifier>113</Identifier>
<SettingValue>System.Data.Odbc</SettingValue>
</Value>
</MyFirstSection>
</MyFirstSectionGroup>
</configuration>
//Tony