批量导入文本文件 我的想法是将文本文件 先整体读入内存,然后在读入到DATASET中或者 将文本文件分割成若干小一号的文本文件,再读取 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 new Thread((ThreadStart)delegate { StreamReader sr = new StreamReader(FileName, Encoding.GetEncoding("gb2312")); int line = 0; string line= sr.ReadLine(); while (line!="") { line= sr.ReadLine(); } sr.Close(); }).Start();http://topic.csdn.net/u/20100714/16/a6d18ba9-1569-411e-b151-c1c9c40a38dd.html string filename = AppDomain.CurrentDomain.BaseDirectory + "aa.txt"; StringBuilder sb = new StringBuilder(); StreamReader reader = null; try { reader = new StreamReader(filename); for (string line = reader.ReadLine(); line != null; line = reader.ReadLine()) { string qty_num = "0"; string[] Str = line.Split(' '); sb.Append(Str[0] + "∩"); for (int i = 1; i < Str.Length; i++) { sb.Append(Str[i] + "_"); } sb.Append("|"); } sb.Append("<input type='text' id='bar_code' value='" + sb.ToString() + "' />"); Response.Write(sb.ToString()); } catch (Exception exp) { Response.Write(exp.ToString()); } finally { } 我的方法是用datatable来读取,文本问价大概在1-10M,数据大概在100万左右。很快的。。 菜鸟求救!怎么把数据库中表1中的字段的所有值写入另一个数据库表中? 关于TcpListener的问题 循环体内的事件问题 判断数据库是否有人在操作 用SQLDMO进行SQL SERVER数据库备份,结果没生成备份文件,急请高手帮忙. new一个ListViewItem问题 视频,为什么找不到指定文件?哪位高手帮帮忙!! 如何结束excel进程 AspNetPager分页问题 c# 怎么实现BHO 急求解答方法 站点地图中 转义字符 如何知道WebRequest的GetResponse()下载的是不是网页
{
StreamReader sr = new StreamReader(FileName, Encoding.GetEncoding("gb2312"));
int line = 0;
string line= sr.ReadLine();
while (line!="")
{
line= sr.ReadLine();
}
sr.Close();
}).Start();
http://topic.csdn.net/u/20100714/16/a6d18ba9-1569-411e-b151-c1c9c40a38dd.html
StreamReader reader = null;
try
{ reader = new StreamReader(filename);
for (string line = reader.ReadLine(); line != null; line = reader.ReadLine())
{
string qty_num = "0";
string[] Str = line.Split(' '); sb.Append(Str[0] + "∩"); for (int i = 1; i < Str.Length; i++)
{
sb.Append(Str[i] + "_");
}
sb.Append("|"); }
sb.Append("<input type='text' id='bar_code' value='" + sb.ToString() + "' />");
Response.Write(sb.ToString());
}
catch (Exception exp)
{
Response.Write(exp.ToString());
} finally
{
}