且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用c#将Excel导入到asp.net中的数据表

更新时间:2023-01-21 23:27:47

Try below link

OLEDB Provider is Not Registered on the Local Machine[^]


Yes, I guess you need to add the reference to your server. Here is the useful links that may helps you:
import excel data to sql server database table and display in gridview[^]
http://***.com/questions/21673283/import-excel-data-to-sql-server-database-table-and-display-in-gridview[^]


So, I think Epplus.dll is the best way to import excel data to datatable.
http://www.aspneto.com/import-csv-excel-data-into-sql-server-using-bulk-insert-asp-net.html[^]


Thank you for all your suggestions! I used this. However, it just accepts Excel in 2003 format

OleDbConnection oconn = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + path + ";Extended Properties='Excel 12.0;HDR=YES;IMEX=1';");