如何从excel文件中获取数据并插入数据库 [英] How fetch data from excel file and insert to database
本文介绍了如何从excel文件中获取数据并插入数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何从excel文件中获取数据并插入数据库
How fetch data from excel file and insert to database
推荐答案
尝试此链接
http://p2p.wrox.com/asp -net-1-0-1-1-professional / 69409-how-insert-data-excel-file-sql-server.html [ ^ ]
http://forums.asp.net/t/1162069.aspx/1 [ ^ ]
http://support.microsoft.com/kb/321686 [ ^ ]
try this links
http://p2p.wrox.com/asp-net-1-0-1-1-professional/69409-how-insert-data-excel-file-sql-server.html[^]
http://forums.asp.net/t/1162069.aspx/1[^]
http://support.microsoft.com/kb/321686[^]
推荐这个
< a href =http://shawpnendu.blogspot.com/2009/05/how-to-import-excel -spreadsheet-data.html> http://shawpnendu.blogspot.com/2009/05/how-to-import-excel-spreadsheet-data.html [ ^ ]
http://www.shiningstar.net/ASPNet_Articles/DataSet/DataSetProject.aspx [ ^ ]
Refer this
http://shawpnendu.blogspot.com/2009/05/how-to-import-excel-spreadsheet-data.html[^]
http://www.shiningstar.net/ASPNet_Articles/DataSet/DataSetProject.aspx[^]
您可以使用OleDB提供程序从Excel获取数据。下面是示例代码。
you can use OleDB provider to fetch data from Excel. below is the sample code.
using System.Data;
using System.Data.OleDb;
...
OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Book1.xls;Extended Properties=Excel 8.0");
OleDbDataAdapter da = new OleDbDataAdapter("select * from MyObject", con);
DataTable dt = new DataTable();
da.Fill(dt);
//I think you knows.. how to insert data from DataTable to DtaBase.
如果有帮助则标记答案..它的动机:)
mark as answer if helps.. it motivates :)
这篇关于如何从excel文件中获取数据并插入数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文