c#读取xml文件到datagridview实例
复制代码 代码如下: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.IO; using System.Xml; using System.Xml.Linq; namespace QueryXMLByLINQ static string strPath = "Employee.xml"; //窗体加载时加载XML文件 //显示选中XML节点的详细信息 #region 将XML文件内容绑定到DataGridView控件 复制代码 代码如下: <?xml version="1.0" encoding="UTF-8"?> -<Peoples> -<People ID="001"> <Name>小王</Name> <Sex>男</Sex> <Salary>1500</Salary> </People> -<People ID="002"> <Name>小吕</Name> <Sex>男</Sex> <Salary>1500</Salary> </People> -<People ID="003"> <Name>小梁</Name> <Sex>男</Sex> <Salary>1500</Salary> </People> </Peoples> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |