Go homepage(回首页)
Upload pictures (上传图片)
Write articles (发文字帖)

The author:(作者)归海一刀
published in(发表于) 2014/1/30 1:24:38
asp.net读取文本文件并加入DataTable中_[Asp.Net教程]

asp.net读取文本文件并加入DataTable中_[Asp.Net教程]
string configfile = Server.MapPath("~/csspath.txt");
string lineStr = null;
DataTable dt = new DataTable();
dt.Columns.Add("loc");

if(File.Exists(configfile))
{
StreamReader re = File.OpenText(configfile);
try{
while((lineStr = re.ReadLine()) != null)
{
DataRow dr = dt.NewRow();
dr["loc"] = lineStr;
dt.Rows.Add(dr);
}
}
finally
{
re.Close();
}
}





If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)





QQ:154298438
QQ:417480759