c# - 在 asp.net MVC 中上传 Excel 文件并在网格中显示

标签 c# asp.net-mvc excel upload

我需要将用户列表从 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/

相关文章:

c# - 使用 Asp.net Identity 删除角色

c# - 服务堆栈/MVC : "AppHostBase.Instance has already been set" error - but can't understand why/how to prevent

excel - 指定键盘快捷键来运行程序

c# - 如何在计时器触发的函数上强制执行单例行为?

替换标记后添加的 C# 字符串插值怪异字符

c# - 如何在 2D 游戏中计算屏幕到世界的位置

asp.net-mvc - 如何使用ASP.NET MVC设置 Multi-Tenancy 应用程序?

php - excel文件的标题另存为

excel - 当数组长度小于提供的数组时,excel中 "Small"函数的处理错误

c# - 选择 Enum 类型的默认值而无需更改值