随笔分类 -  代码库

C#操作XML
摘要:参考文章:http://msdn.microsoft.com/zh-cn/library/system.xml%28v=vs.100%29.aspx创建xml 方法一XmlDocument xmlDocument = new XmlDocument();//在XML的文档的最头部加入XML的声明段落 XmlNode xmlnode = xmlDocument.CreateNode(XmlNodeType.XmlDeclaration, "", "");xmlDocument.AppendChild(xmlnode);//创建根节点XmlElement r 阅读全文

posted @ 2014-02-08 17:30 AngelLee2009 阅读(206) 评论(0) 推荐(0)

POST GET 请求示例
摘要:HTTP GET 请求代码:HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://www.baidu.com/");HttpWebResponse response = (HttpWebResponse)request.GetResponse();Stream receiveStream = response.GetResponseStream();StreamReader readStream = new StreamReader(receiveStream, Encoding.UTF8);s 阅读全文

posted @ 2014-02-08 16:59 AngelLee2009 阅读(2460) 评论(1) 推荐(0)

C#从Excel中读取数据为空
摘要:将HDR设置为YES,IMEX设置为1即可。OleDbConnection objConn = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + strFilePath + ";Extended Properties='Excel 12.0;HDR=YES;IMEX=1;'");如有问题,参考:C#读取Excel,取值为空的解决办法! 阅读全文

posted @ 2013-07-31 21:02 AngelLee2009 阅读(434) 评论(0) 推荐(0)

文件上传下载代码
摘要:using System;using System.Web;using System.IO;using System.Text;using System.Web.UI.WebControls;namespace BD{ public class FileUtil { #region 文件路径 /// /// 得到没有后缀的文件名 /// /// /// public static string GetFileNameWithoutExtension(string _FullNa... 阅读全文

posted @ 2013-07-09 20:54 AngelLee2009 阅读(376) 评论(0) 推荐(0)

读取Excel文件
摘要:[Flags]private enum HDR { YES, NO };/// /// 读取Excel文件内容/// /// Excel文件路径/// YES(默认),表示第一行是标题,不做数据使用;NO,表示第一行不是标题,做数据使用/// /// EMEX(IMport EXport Mode)/// IMEX=0 汇出模式 写入用途;1 汇入模式 读取用途;2 连結模式 读取写入用途/// /// Excel内容private DataSet GetExcel(string strFilePath, HDR hdr = HDR.YES, int EMEX = 0){ DataSet... 阅读全文

posted @ 2013-07-05 12:27 AngelLee2009 阅读(310) 评论(0) 推荐(0)

导航