在Silverlight中读取CVS文件的问题 [英] Issue in reading CVS file in Silverlight
本文介绍了在Silverlight中读取CVS文件的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
读取CSV文件时,每行中的第一个字符都丢失….就是这种情况.
CSV文件数据…
Hi,
While reading CSV file, in each line first character is missing…. Here is the case..
CSV file data…
Reported Date Name Status
4/19/2011 18:52 INC000005134305 Closed
4/19/2011 18:48 INC000005134250 Closed
4/19/2011 18:11 INC000005134058 Closed
代码..
Code..
OpenFileDialog Prp_Opendialogue = new OpenFileDialog();
bool? lBlnFile = Prp_Opendialogue.ShowDialog();
if ((bool)lBlnFile)
{
FileInfo lObjFileInfo = Prp_Opendialogue.File;
}
StreamReader lObjStreamReader = new StreamReader(Prp_Opendialogue.File.OpenRead());
bool lBlnIsColumnRow = true;
while (lObjStreamReader.Read() != null)
{
string lStrLine = lObjStreamReader.ReadLine();
}
………….
在此lStrline
中,我得到"/19/2011 18:52, INC000005134305, Closed
",在这里您可以看到缺少4.我怎么能得到这个...
任何想法请..
Sreenath
Here in this lStrline
, I am getting "/19/2011 18:52, INC000005134305, Closed
", Here you can see 4 is missing. How can I get this…
Any ideas please..
Sreenath
推荐答案
调用lObjStreamReader.Read()时,将读取第一个字符.不要拨打电话,您的"4"也不会丢失.
When you call lObjStreamReader.Read() you read the first character. Don''t make that call and your ''4'' won''t be missing.
StreamReader lObjStreamReader = new StreamReader(Prp_Opendialogue.File.OpenRead());
bool lBlnIsColumnRow = true;
string lStrLine;
while ((lStrLine = lObjStreamReader.ReadLine()) != null)
{
// do something with lStrLine
}
详细信息,请参见 ^ ];我四天前给了你答案.
Sreenath, see Loadin a CSV file into a DataGrid in Silverlight 4 Application[^]; I gave you the answer 4 days ago.
这篇关于在Silverlight中读取CVS文件的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文