1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| Dim dset As New DataSet
'Dim Drow As New DataRow
Dim MyCommand As System.Data.OleDb.OleDbCommand
Dim MyConnection As System.Data.OleDb.OleDbConnection
Dim adapter As New OleDb.OleDbDataAdapter
Dim CmdBuild As New OleDb.OleDbCommandBuilder
'Dim i As Integer
Try
MyConnection = New System.Data.OleDb.OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0;data source= " & Me.TextBox1.Text & " ;Extended Properties=Excel 8.0;")
MyCommand = New OleDb.OleDbCommand("select * from [DSA MAROC$]")
adapter.SelectCommand = MyCommand
MyCommand.Connection = MyConnection
adapter.Fill(dset, "table")
Me.DataGridView1.DataSource = dset.Tables("table")
Catch ex As Exception
MsgBox("Exception :" & ex.Message)
End Try |
Partager