⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 iconfiguration.cs

📁 c#数据库访问自动生成代码程序
💻 CS
字号:
using System;
using System.Collections;
using System.Text;
using System.Xml;

namespace IDBO
{
    class IConfiguration{

        public static ArrayList Attribute(string configname,string mostlyelem,string childmostlyelem)
        {
            ArrayList al = new ArrayList();

            XmlDocument doc = new XmlDocument();
            doc.Load(configname);

            //建立所有元素的列表
            XmlElement root = doc.DocumentElement;

            //把所有的主要标记都找出来放到节点列表中
            XmlNodeList elemList = root.GetElementsByTagName(mostlyelem);

            for (int i = 0; i < elemList.Count; i++)
            {
                //获取二级标记子节点
                XmlNodeList elemList1 = ((XmlElement)elemList[i]).GetElementsByTagName(childmostlyelem);
                //获取这个节点的数目
                int N = elemList1.Count;
                for (int j = 0; j < elemList1.Count; j++)
                {
                    Hashtable hs = new Hashtable();
                    //获取这个节点的属性集合
                    XmlAttributeCollection ac = elemList1[j].Attributes;
                    for (int k = 0; k < ac.Count; k++)
                    {
                        hs.Add(ac[k].Name, ac[k].Value);
                    }
                    al.Add(hs);

                }
            }
            return al;
        }
        public static string getParameter(string name){
			string value=null;
		    
			
			ArrayList al=Attribute("./IDBO.xml","connection","add");
			
			for (int i=0;i<al.Count;i++)
			{
			   Hashtable hs=(Hashtable)al[i];
				if (hs["key"].ToString().Equals(name))
				{
					value=hs["value"].ToString();
					
                    break;
				}
			}
            return  value;
       }
    }

    
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -