List<Question> questionList=new List<Question>();
  questionList=iQuestion.findAll();
  int i=0;
  string tmppath = null;    
  int SeekVal=0;  tmppath = (string)path;
  FileStream fs;
  fs = new FileStream(tmppath, FileMode.Truncate);  BinaryWriter bw = new BinaryWriter(fs);
  for(i=0;i<questionList.Count;i++)
  {
  string ss=questionList[i].FileResource.Length.ToString();
    
  bw.Write(questionList[i].FileResource,(int)bw.Seek(SeekVal,SeekOrigin.Begin),   
  questionList[i].FileResource.Length);
  SeekVal = SeekVal + questionList[i].FileResource.Length;
  }
    
    
  bw.Write(questionList[i].FileResource,(int)bw.Seek(SeekVal,SeekOrigin.Begin),   
  questionList[i].FileResource.Length); 这句话老报错,求解,谢谢。
求大神帮助啊,求大神啊!

解决方案 »

  1.   

     bw.Write(questionList[i].FileResource,(int)bw.Seek(SeekVal,SeekOrigin.Begin),   
      questionList[i].FileResource.Length);  
     偏移量和长度超出数组的界限,或者计数大于从索引到源集合结尾处的元素数量。这行有错,错误信息是以上。
      

  2.   

    改成 bw.Write(questionList[i].FileResource);
      

  3.   

    不行啊,jshi123,改成你说的我只往word里写入了一条记录啊,其他的记录没写进去啊。
      

  4.   

    for(i=0;i<questionList.Count;i++)
      {
      bw.Write(questionList[i].FileResource);
      }
    这样可以写多条
      

  5.   

    jshi,你说的那样我试过了,但是最后写入的是最后一条数据啊。