摘要: /////// string qString = Request.ServerVariables["Query_String"]; Response.Write(qString); string[] q1 = qString.Split('&'); Response.Write("<BR>"); ArrayList aa = new ArrayList(); ArrayList bb = new ArrayList(); foreach (string qq in q1) { Response.Write(qq); R 阅读全文
posted @ 2011-08-09 15:02 hellowing 阅读(225) 评论(0) 推荐(0)
摘要: 首先需导入命名空间:using System.IO;string path = @"D:\";DirectoryInfo dir = new DirectoryInfo(path); foreach(FileSystemInfo fsi in dir.GetFileSystemInfos()) { if (fsi is FileInfo) { FileInfo fi = (FileInfo)fsi; //获得文件 } else { DirectoryInfo di = (DirectoryInfo)fsi; //获得文件夹 } }这样可以获取一个目录里的所有内容:包括文件和 阅读全文
posted @ 2011-07-13 11:44 hellowing 阅读(738) 评论(0) 推荐(0)
摘要: Response.Write(Server.MapPath("test.xls")+"<BR>"); string strPath = Server.MapPath("test.xls"); DataSet ds = ExcelToDS(strPath); //获取字段名称 //Response.Write(ds.Tables[0].Columns[1].ColumnName.ToString()); //获取表格名称 //Response.Write(ds.Tables[0].TableName); //获取DATASE 阅读全文
posted @ 2011-07-07 18:05 hellowing 阅读(352) 评论(0) 推荐(0)
摘要: 方法代码: public DataSet ExcelToDS(string Path) { //定义EXCEL文件链接字符串 string strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + Path + ";" + "Extended Properties=Excel 8.0;"; //实例化OledConnection链接 OleDbConnection conn = new OleDbConnection(strConn); //打 阅读全文
posted @ 2011-07-07 14:14 hellowing 阅读(427) 评论(0) 推荐(0)