代码语言:javascript复制
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim Sql = "SELECT * from [A$];"
Dim cn As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:A.xls;Extended Properties='Excel 12.0;HDR=NO;IMEX=1';"
Dim ad As New OleDb.OleDbDataAdapter
Dim cnole As New OleDb.OleDbConnection(cn)
ad.SelectCommand = New OleDb.OleDbCommand(Sql, cnole)
Dim DT As New DataTable
ad.Fill(DT)
DataGridView1.DataSource = DT
End Sub
代码语言:javascript复制