asp.net实现从Txt文件读取数据到数据视图的方法

这篇文章主要介绍了asp.net实现从Txt文件读取数据到数据视图的方法,涉及asp.net针对文本文件的遍历操作与DataView的写入操作相关技巧,需要的朋友可以参考下

本文实例讲述了asp.net实现从Txt文件读取数据到数据视图的方法。分享给大家供大家参考,具体如下:

 #region 从Txt文件读取数据到数据视图 /// 从Txt文件读取数据到数据视图 ///  /// 文件路径 /// 返回一个数据视图 public static DataView GetDataFromTxt(string strTxtPath) { string strLine = ""; DataRow row; try { DataTable tbl = new DataTable(); StreamReader sr = new StreamReader(strTxtPath, Encoding.GetEncoding("GB2312")); strLine = sr.ReadLine(); //读取第一行列属性 string[] Fields = strLine.Split(new char[] { '/t' });//读取每一个字段(以TAB分开) for (int k = 0; k 

希望本文所述对大家asp.net程序设计有所帮助。

以上就是asp.net实现从Txt文件读取数据到数据视图的方法的详细内容,更多请关注0133技术站其它相关文章!

赞(0) 打赏
未经允许不得转载:0133技术站首页 » ASP编程