Upload Excel File and display in Grid in asp.net MVC

寵の児 提交于 2019-12-03 07:48:38

问题


I need to export the Users List from excel to my asp.net mvc(C#) application.

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,

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?


回答1:


I think that it would be best, in this case, to use ADO.NET.

A few articles on how to do this in order to read values from an Excel Worksheet:

(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)

I think that this should get you to where you need to go.

-- Mike



来源:https://stackoverflow.com/questions/1553417/upload-excel-file-and-display-in-grid-in-asp-net-mvc

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