首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

app.config配置有关问题

2012-01-03 
app.config配置问题??xmlversion 1.0 encoding utf-8 ?configuration!-- appSettingsaddkey

app.config配置问题?
<?xml   version= "1.0 "   encoding= "utf-8 "   ?>
<configuration>
  <!-- <appSettings>
              <add   key= "MySqlUID "   value= "root "/>
              <add   key= "MySqlPwd "   value= "123 "/>
  </appSettings> -->
    <configSections>
        <section   name= "MySql "   type= "System.Configuration.NameValueSectionHandler "/>
    </configSections>
    <MySql>
        <add   key= "db "   value= "System "/>
        <add   key= "uid "   value= "root "/>
        <add   key= "pwd "   value= "123 "/>
    </MySql>
</configuration>
用分组配置出现了

未能找到元素“add”的架构信息
未能找到元素“key”的架构信息

[解决办法]
<appSettings>
<add key= "MySqlUID " value= "root "/>
<add key= "MySqlPwd " value= "123 "/>
</appSettings>
这样呢?

[解决办法]
<?xml version= "1.0 " encoding= "utf-8 " ?>
<configuration>
<appSettings>
<add key= "MySqlUID " value= "root "/>
<add key= "MySqlPwd " value= "123 "/>
</appSettings>
<configSections>
<section name= "MySql " type= "System.Configuration.NameValueSectionHandler "/>
</configSections>
<MySql>
<add key= "db " value= "System "/>
<add key= "uid " value= "root "/>
<add key= "pwd " value= "123 "/>
</MySql>
</configuration>

[解决办法]
<!-- <appSettings>
<add key= "MySqlUID " value= "root "/>
<add key= "MySqlPwd " value= "123 "/>
</appSettings> -->
的註釋去掉!
<appSettings>
<add key= "MySqlUID " value= "root "/>
<add key= "MySqlPwd " value= "123 "/>
</appSettings>
就好了!

热点排行