110,534
社区成员
发帖
与我相关
我的任务
分享
FileStream fs = new FileStream("a.csv", FileMode.OpenOrCreate);
StreamReader sr = new StreamReader(fs);
string Msg = sr.ReadLine();
while (Msg != null)
{
Controls[Msg.Split(',')[0]].Text = Msg.Split(',')[1];
Msg = sr.ReadLine();
}
sr.Close();
fs.Close();
TADE Name,ER110925A01162701 √
Bin,27
Total QTY,10000 √
Date, 2011-09-25 √
Time,16:28:34
Part No,
Machine No,A01
string path = @"D:/1.csv";//读取文件csv
StringBuilder b = new StringBuilder();
using (FileStream fs = new FileStream(path, FileMode.Open))
{
using (StreamReader sr = new StreamReader(fs,Encoding.Default))
{
while (!sr.EndOfStream)
{
string sLine = sr.ReadLine();
if (sLine.Length < 1)
{
continue;
}
string[] sRecordKbn =sLine.Split(',');
foreach (string s in sRecordKbn)
{
if (s.Contains("√"))
{
b.Append(s + "<br/>");
}
}
}
}
}
Response.Write(b.ToString());