简体   繁体   English

上传Excel文件并在asp.net MVC中的Grid中显示

[英]Upload Excel File and display in Grid in asp.net MVC

I need to export the Users List from excel to my asp.net mvc(C#) application. 我需要将用户列表从excel导出到我的asp.net mvc(C#)应用程序。

The Excel should have an header like First Name Last Name Email ,... Excel应该有一个标题,如名字姓氏电子邮件 ,...
and its values like John Smith john@gmail.com, David Beckam david@gmail.com, 它的价值如John Smith john@gmail.com,David Beckam david@gmail.com,

Need to validate the values before storing it to my database and show it in the grid of next page. 需要在将值存储到我的数据库之前验证这些值,并将其显示在下一页的网格中。

Is there any easy way to do it, like a plugin? 有没有简单的方法来做它,比如一个插件?

I think that it would be best, in this case, to use ADO.NET. 我认为在这种情况下最好使用ADO.NET。

A few articles on how to do this in order to read values from an Excel Worksheet: 有关如何执行此操作以便从Excel工作表中读取值的一些文章:

(1) Reading and Writing Excel Spreadsheets Using ADO.NET C# DbProviderFactory (David Hayden) (1) 使用ADO.NET读取和编写Excel电子表格C#DbProviderFactory(David Hayden)

(2) Import Excel File to DataSet (CodeProject) (2)将Excel文件导入DataSet(CodeProject)

(3) Tips for reading Excel spreadsheets using ADO.NET (Lab49) (3) 使用ADO.NET阅读Excel电子表格的提示(Lab49)

(4) Reading Excel files from C# (Stack Overflow) (4) 从C#中读取Excel文件(Stack Overflow)

I think that this should get you to where you need to go. 我认为这应该让你到达你需要去的地方。

-- Mike - 迈克

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM