不添加自定义节点  Configuration.ConfigurationManager.AppSetings["SqlConn"]是正确的

解决方案 »

  1.   

    SqlConn。后台调用这个key取值
    好像是AppSettings还是什么 忘了
      

  2.   

    不行  因为添加了自定义节点 
    怎么没有高手呀补充一下由于笔误 <XmlInfo XmlNo="1" SportsType="0" PoolNo="0"> 改为
    <XmlInfo XmlNo="1" SportsType="0" PoolNo="0"/> 
      

  3.   

    把文件当成一个XML文件来读。之前我的工程在某台机子上死活读不了,也是当成普通XML文件来读才解决的。
      

  4.   

    当成XML文件来读的方法我也试过了  可是还是
    在SqlConnection con = new SqlConnection(SqlConn);
    出现错误the type initializer for 'System.Data.SqlClient.SqlConnection' threw an exception 
      

  5.   

                    XmlDocument xmlDoc = new XmlDocument();
                    xmlDoc.Load(Application.StartupPath + "\\Login.xml");
                    XmlNodeList nodeList = xmlDoc.SelectSingleNode("LocalScan").ChildNodes;
                    foreach (XmlNode xn in nodeList)//遍历所有子节点
                    {
                        XmlElement xe = (XmlElement)xn;
                        XmlNodeList nls = xe.ChildNodes;//继续获取xe子节点的所有子节点
                        if (xe.Name == "connectionstring1")//如果找到
                        {
                            sqlstring = xe.InnerText.ToString().Trim();
                        }
                    }
    我工程里面是这样搞的,至少能用,你再尝试一下