我需要将用户列表从 excel 导出到我的 asp.net mvc(C#) 应用程序。
The Excel should have an header like First Name Last Name Email,...
and its values like John Smith john@gmail.com, David Beckam david@gmail.com,
在将值存储到我的数据库并将其显示在下一页的网格中之前需要验证这些值。
有没有什么简单的方法,比如插件?
最佳答案
我认为在这种情况下最好使用 ADO.NET。
几篇文章介绍了如何执行此操作以从 Excel 工作表中读取值:
(1) Reading and Writing Excel Spreadsheets Using ADO.NET C# DbProviderFactory (David Hayden)
(2) Import Excel File to DataSet (CodeProject)
(3) Tips for reading Excel spreadsheets using ADO.NET (Lab49)
(4) Reading Excel files from C# (Stack Overflow)
我认为这应该可以让您到达需要去的地方。
-- 迈克
关于c# - 在 asp.net MVC 中上传 Excel 文件并在网格中显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1553417/