Reading data from Excel sheet using entity framework

天大地大妈咪最大 提交于 2020-12-26 01:50:56

问题


We have some info that is contained within an excel sheet. the excel sheet contains two columns; customer name + customer balance. Now I need to display this info inside my asp.net mvc view, basically to query the excel sheet based on the customer name and display its total balance inside my view.

In this way we will be uploading the excel sheet inside our system each month or each day , and we will be querying the excel sheet instead of the DB. So is this possible using EF ? or it is better to exact the data from the excel sheet and add it to Datable inside the database? Thanks


回答1:


You can use LinqToExcel , this provides normal linq structure to query excel sheets




回答2:


Excel is not a database system so don't think directly you can use the entity framework. But yes Excel can be read using .net APIs




回答3:


It is better to extract the data from the excel sheet and add it to Datable which you can do using oledbconnection object , connectionobject.GetOleDbSchemaTable.




回答4:


FileContextCore seems like an effort to make excel and other file types work in EF Core. Obviously this can be nice for consistency if you're already using EF Core.



来源:https://stackoverflow.com/questions/27778572/reading-data-from-excel-sheet-using-entity-framework

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!