1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| Imports System.Data.OleDb
Dim connexion As New System.Data.OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & My.Application.Info.DirectoryPath & "\madb.accdb;Jet OLEDB:Database")
Try
connexion.Open()
Dim reqaffich As String = "SELECT matable.col1, matable.col2, matable.col3, matable.col4 FROM(matable) ORDER BY matable.col2 DESC, matable.col3 DESC;"
Dim cmdaffich As New OleDbCommand(reqaffich, connexion)
Dim adaptaffich As New OleDbDataAdapter(cmdaffich)
Dim dsaffich As New DataSet
Try
adaptaffich.Fill(dsaffich, "matable")
DataGridView1.DataSource = dsaffich.Tables("matable")
Catch ex As Exception
MsgBox(ex.Message)
End Try
Catch ex As Exception
MsgBox(ex.Message)
Finally
connexion.Close()
End Try |
Partager