asp.net 读取csv 文件 asp.net 读取csv 文件我现在要读csv文件的表头,判断csv文件有多少列,列名分别是什么 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 using System; using System.Collections.Generic; using System.IO; using System.Text; namespace CSVDemo { /// <summary> /// CSVUtil is a helper class handling csv files. /// </summary> public class CSVUtil { private CSVUtil() { } //write a new file, existed file will be overwritten public static void WriteCSV(string filePathName,List<String[]>ls) { WriteCSV(filePathName,false,ls); } //write a file, existed file will be overwritten if append = false public static void WriteCSV(string filePathName,bool append, List<String[]> ls) { StreamWriter fileWriter=new StreamWriter(filePathName,append,Encoding.Default); foreach(String[] strArr in ls) { fileWriter.WriteLine(String.Join (“,",strArr) ); } fileWriter.Flush(); fileWriter.Close(); } public static List<String[]> ReadCSV(string filePathName) { List<String[]> ls = new List<String[]>(); StreamReader fileReader=new StreamReader(filePathName); string strLine=""; while (strLine != null) { strLine = fileReader.ReadLine(); if (strLine != null && strLine.Length>0) { ls.Add(strLine.Split(',')); //Debug.WriteLine(strLine); } } fileReader.Close(); return ls; } } } 给个读取CSV的方法,不知道是不是你想要的! 本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/gisfarmer/archive/2009/09/09/4533970.aspx js绑定下拉列表 如何实现电机button的时候 FileUpload中的数据不会被清理掉 asp.net + xml开发 asp.net的简单问题 求高手帮忙啊,VS2003出错了 100分!请教Infragistics NetAdvantage组件中Weblistbar控件的使用!(急) asp.net运行环境的问题(在线等待) 请问像csdn的每个页面的地址都加个?temp=.357052或?room=5202是什么意思 如何使用上、下、左、右鍵讓光標在datagrid的單元格之間移動。200分在線等!!! 求asp.net入门电子书籍? Ajax分页 问题解决 立即结帖 高手帮忙 Session丢失时自动跳转到登陆页面
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货