摘要: OK,在linq之前,可以试用XMLDocment将xml整个文件读进来,然后比如可以用xpath再进行分析。自从有了linq,一切都变得简单了,实现代码如下:这样即可。OK,我们现在将上面的XML结构稍作改动一下,OK,这时候linq的优势就很明显了,实现代码如下:如果没有Linq To XML,用xpath也可以解决这样的取值问题,但是会变得复杂很多。 阅读全文
posted @ 2010-11-19 22:10 leco_lin 阅读(3731) 评论(0) 推荐(0) 编辑
摘要: 在上一篇日志《用C#读取Excel返回DataSet》中,提到了用C#读取Excel的方法,可以发现,用这种方法读取excel2003完全没有问题,可是,当我们读取Excel2007时,就会发现visual studio报错:External table is not in the expected format.其实,这个错误是由于Excel版本的连接字符串引起的错误,在上一篇日志提到的方法中,... 阅读全文
posted @ 2010-11-19 21:18 leco_lin 阅读(4656) 评论(5) 推荐(1) 编辑
摘要: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Net; using System.IO; using System.IO.Compression; using System.Text.RegularExpressions; namespace ... 阅读全文
posted @ 2010-11-19 17:14 leco_lin 阅读(1780) 评论(0) 推荐(0) 编辑
摘要: 不添加任何 excel dll 引用,代码很简单,就不做解释了。 阅读全文
posted @ 2010-11-19 00:10 leco_lin 阅读(2375) 评论(0) 推荐(0) 编辑