简体   繁体   中英

C# - Load simple Excel file into a datatable using FileUpload control

I'm trying to figure out how to populate a datatable with data from and Excel file that's been uploaded using the FileUpload control. Does anyone know of a tutorial to do this?

I haven't been able to find anything on Google, maybe using wrong search terms?

Use LinqToExcel to parse data. Then, when you have the data in memory, put it into a database whichever way you prefer.

Perhaps an alternative way? This is vb.net but the same objects. I do this sort of thing all the time.

http://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/7337ad66-7673-425b-97ff-41adbd8a68e9

Look at this:

http://forums.asp.net/t/1255191.aspx/1

It is C#, using OLEDB so third party libraries are not needed, and a DataTable is populated with the excel data.

These are my google search terms: "upload excel file to datatable c#"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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