ADO.NET 如何读取 Excel
2008-09-28 08:36
351 查看
转自:http://kb.cnblogs.com/page/42229/
经常需要在数据库与Execl之间互导数据。net时代,ADO.NET可以使用使用Microsoft.Jet.OleDb访问访问Excel,网上已经有很多类似的资源,最典型也是最简单的可能如下:(asp.net环境)
[code]Code
Dim strConnE As String = "Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source='" & WebPath _
& "';Extended Properties='Excel 8.0;IMEX=1'"
Dim connE As OleDbConnection = New OleDbConnection(strConnE)
connE.Open()
Dim cmd As OleDbCommand = New OleDbCommand("SELECT * FROM [Sheet1$]", connE)
Dim da As OleDbDataAdapter = New OleDbDataAdapter
da.SelectCommand = cmd
Dim ds As DataSet = New DataSet
da.Fill(ds, "myExcel")
经常需要在数据库与Execl之间互导数据。net时代,ADO.NET可以使用使用Microsoft.Jet.OleDb访问访问Excel,网上已经有很多类似的资源,最典型也是最简单的可能如下:(asp.net环境)
[code]Code
Dim strConnE As String = "Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source='" & WebPath _
& "';Extended Properties='Excel 8.0;IMEX=1'"
Dim connE As OleDbConnection = New OleDbConnection(strConnE)
connE.Open()
Dim cmd As OleDbCommand = New OleDbCommand("SELECT * FROM [Sheet1$]", connE)
Dim da As OleDbDataAdapter = New OleDbDataAdapter
da.SelectCommand = cmd
Dim ds As DataSet = New DataSet
da.Fill(ds, "myExcel")
相关文章推荐
- ADO.NET 如何读取 Excel (上)
- 黑马程序员之ADO.NET学习笔记:ADO.NET如何读取Excel
- excel读写技术-:ADO.NET 如何读取 Excel
- ADO.NET 如何读取 Excel (下)
- ADO.NET 如何读取 Excel (上)
- ado.net如何读取Excel
- ado.net如何读取excel(1)
- ADO.NET 如何读取 Excel
- ADO.NET 如何读取 Excel (下)
- ado.net 如何读取 excel
- ado.net 如何读取 excel
- ADO.NET 如何读取 Excel (上)
- ADO.NET 如何读取 Excel (上)
- ADO.NET 如何读取 Excel (下)
- ado.net如何读取excel(2)
- ADO.NET 如何读取 Excel (上)
- ado.net 如何读取 excel
- ADO.NET 如何读取 Excel (下)
- ado.net 如何读取 excel
- ado.net 如何读取 excel