Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# IExcelDataReader-最后一期专栏文章_C#_Excel_C# 4.0 - Fatal编程技术网

C# IExcelDataReader-最后一期专栏文章

C# IExcelDataReader-最后一期专栏文章,c#,excel,c#-4.0,C#,Excel,C# 4.0,我正在使用Excel到数据集转换概念C#。为此,我使用IExcelDataReader 这是我的密码 string AttachmentPath = Server.MapPath(".") + @"\" + FileUpload1.FileName; FileUpload1.SaveAs(AttachmentPath); FileStream stream = File.Open(AttachmentPath, FileMode.Open, FileAccess.Read); I

我正在使用Excel到数据集转换概念C#。为此,我使用IExcelDataReader

这是我的密码

  string AttachmentPath = Server.MapPath(".") + @"\" + FileUpload1.FileName;
  FileUpload1.SaveAs(AttachmentPath);
  FileStream stream = File.Open(AttachmentPath, FileMode.Open, FileAccess.Read);
  IExcelDataReader excelReader = ExcelReaderFactory.CreateBinaryReader(stream);
  excelReader.IsFirstRowAsColumnNames = true;
  DataSet result = excelReader.AsDataSet();

我的问题是,excel中的最后一列没有导出到数据集。例如,每当我在.xls中有5列时,转换到dataset后,我只得到4列。跳过了最后一列。除此之外,我没有使用任何代码。

是否尝试另存为excel 2007?我以前听说过这个问题2003@Mr.Monshaw非常感谢……这很有道理。。。。