1 2 3 4 5 6 | Imports Microsoft.Office.Interop Imports System.IO Imports System.Data Imports System.Data.SqlClient Imports System.Data.OleDb.OleDbConnection Imports System.Data.OleDb |
1 2 3 4 5 6 7 8 9 10 11 12 13 | Private Sub ReadXLSX(strPath As String) Dim conn As OleDb.OleDbConnection Dim dta As OleDbDataAdapter Dim dts As DataSet conn = New OleDbConnection("provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & strPath & ";Extended Properties=Excel 12.0;") dta = New OleDbDataAdapter("select * from [各壇報名表$]", conn) dts = New DataSet dta.Fill(dts, "[各壇報名表$]") DataGridView1.DataSource = dts DataGridView1.DataMember = "[各壇報名表$]" conn.Close() End Sub |
沒有留言:
張貼留言