string s;
while((s = streamReader.ReadLine()) != null)
{
.............;
}

解决方案 »

  1.   

    string s;
    do
    {
    .............;
    }while((s = streamReader.ReadLine()) != null)
      

  2.   


    while(this.dataReader.Read())
    {}
      

  3.   

    while(streamReader.Peek!=-1 )
    {}
      

  4.   

    streamReader.ReadLine
    输入流中的下一行;如果到达了输入流的末尾,则为空引用(Visual Basic 中为 Nothing)。你读到最后一行的时候,条件为空,就已经跳出了
    当然读不出来最后一样了……
      

  5.   

    楼主的代码没有问题的
    楼主要给出全部的代码,估计是楼主的while循环体的问题,楼主是不是在里面用了streamReader.ReadLine
      

  6.   

    楼主的代码也许有个小问题:我也读过文件,一般是先读一行的
    楼主可以尝试用一下以下的代码:
    string s;
    s = streamReader.ReadLine();
    while(s!= null)
    {
     s = streamReader.ReadLine();
    .............;
    }
      

  7.   

    while里面的代码拿来看看,估计是里面的代码有问题
      

  8.   

    一路向北是正解
    string s;
    do
    {
    .............;
    }while((s = streamReader.ReadLine()) != null)
      

  9.   

    public static string GetConnStr()  //求连接数据库连接字符串
            {
                string source = "";
                FileStream fs = new FileStream(Application.StartupPath + "\\ConnConfig.ini", FileMode.Open, FileAccess.Read, FileShare.None);
                StreamReader sr = new StreamReader(fs);
                while (!sr.EndOfStream)   //直到文件结束
                {
                    source += sr.ReadLine();
                    source += ";";
                }
                fs.Close();
                sr.Close();
                return source;
            }
    不知能不能帮助你?
      

  10.   

    string str_ofread;
    str_ofread = sr_read_stru.ReadLine();
    while (str_ofread!=null )
    {
    this.listBox_stru.Items.Add(str_ofread);
    str_ofread = sr_read_stru.ReadLine();
    }try this!!!