asp.net-core - 将 .net core 2.1 升级到 .net core 2.2 时,Linq to excel 不起作用
问题描述
> 我的项目使用的是 .Net core 2.1。我使用 LINQ 来获得
从excel文件中读取数据。当我将项目升级到 .Net core 2.2 时。它不工作。
我从 excel 文件中读取数据的代码是
string pathToExcelFile = "path to excel file."
ExcelHelper ConxObject = new ExcelHelper(pathToExcelFile);
var query = from a in ConxObject.UrlConnexion.Worksheet<ExcelProcessFollowUp>()
select a;
var data = query.ToList();
//excel的帮助类
public class ExcelHelper
{
public string _pathExcelFile;
public ExcelQueryFactory _urlConnexion;
public ExcelHelper(string path)
{
this._pathExcelFile = path;
this._urlConnexion = new ExcelQueryFactory(_pathExcelFile);
}
public string PathExcelFile
{
get
{
return _pathExcelFile;
}
}
public ExcelQueryFactory UrlConnexion
{
get
{
return _urlConnexion;
}
}
}
但它现在不起作用,请给出一些解决方案。
解决方案
这是 OleDb 驱动程序在 .Net Core 2.x 版本中不起作用的问题。它应该在 .Net Core 3.0 中修复(请参阅此GitHub 问题)
您能否尝试升级到 .Net Core 3.0 并查看 LinqToExcel 是否适合您。
推荐阅读
- matlab - 访问存储在不同文件夹中的不同文件中的数据
- java - 在多个项目中使用 Java 反射的奇怪问题
- php - 如何使用 phpQuery 获取下一页 url?
- go - 接口未实现错误(缺少错误方法)
- ruby-on-rails - 我如何使用 capistrano 进行部署
- google-app-engine - gcloud app deploy 失败:来自请求 [URL] 的 [ID] 权限被拒绝
- linux - Subversion Server 使用 Active Directory 错误
- sql-server - 如何将值 STATUS 从 1 更改为 0
- stream - C-SPARQL 查询 - 匹配精确的字符串文字
- javascript - 在 Javascript 中调整图像大小后如何获取图像文件大小?