从.NET应用程序中的Excel文件中检索数据 [英] Retrieving data from an Excel file in a .NET app

查看:108
本文介绍了从.NET应用程序中的Excel文件中检索数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的ASP网站中,我使用'Microsoft.ACE.OLEDB.12.0'作为提供程序从.xlsx Excel工作表中获取数据。

网站托管在两个相同的64位OS服务器中。 />


这两台服务器是相似的,在两台服务器的下面路径中,找到相同版本的'ACEOLEDB.DLL'



C:\Program Files(x86)\ Common Files \ MySoft软件共享\ OFFFFICE14 \ACEOLEDB.DLL



但问题是当我向同一个.xlsx Excel工作表添加新行时,一个服务器托管站点不读取添加的那些新行,而另一个服务器托管相同站点正在按预期读取Excel工作表(即添加新行)



很明显,这两个服务器可能有不同的组件,对同一个编码(站点)的读取方式不同有相同的Excel文件。



任何人都可以帮我跟踪不同的内容。

In my ASP website I use 'Microsoft.ACE.OLEDB.12.0' as the provider to get data from .xlsx Excel sheet.
Site is hosted in two simile 64bit OS servers.

The two servers are alike and in below path of the both server,the same versions of 'ACEOLEDB.DLL' is found

C:\Program Files (x86)\Common Files\Microsoft Shared\OFFICE14\ACEOLEDB.DLL

But the issue is when I added new rows to the same .xlsx Excel sheet then one server hosted site doesn't read those new rows added while the other server hosted same site is reading the excel sheet as expected (i.e. with the added new rows)

It is obvious those two servers might be having different component to have different impact on same coding (site) reading same Excel file differently.

Can anyone please help me to track what is the different.

推荐答案

Excel不是一个多用户数据库格式/文件/引擎,所以你不应该期望它在这样的庄园中使用它。



另外你不应该使用Office ASP.net网站上的Excel自动化,因为它无法扩展并在后台运行EXCEL.EXE尝试使用如下组件: http://epplus.codeplex .com / [ ^ ]
Excel is not a multi-user database format/file/engine so you should not expect it to use it in such a manor.

Also you should not use Office Excel automation on ASP.net sites since it will not scale and runs EXCEL.EXE in the background try using a component like : http://epplus.codeplex.com/[^]


使用Open XML SDK 2.0我能够解决我的问题。
Using Open XML SDK 2.0 I was able to solve my issue.


这篇关于从.NET应用程序中的Excel文件中检索数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆