1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| Private Sub classement_Click(sender As Object, e As EventArgs) Handles classement.Click
Try
Using conn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\KEUNENE-PC\ecole\ecole.mdb;")
conn.Open()
Dim command As New OleDbCommand("SELECT id,nom,prenoms,annee_scolaire,trimestre,classe,count(id) AS NOMBRE_NOTES,AVG(notra) as moyenne_trimestrielle,(SELECT COUNT(*) FROM (SELECT DISTINCT id FROM notio) AS T2 WHERE T2.id >= T1.id) AS CLASSEMENT FROM notio AS T1 where classe = '" & classe.Text & "' and trimestre = '" & trimestre.Text & "' and année_scolaire = '" & annee.Text & "' GROUP BY id,nom,prenoms,annee_scolaire,trimestre,classe,rang ORDER BY AVG(notra) DESC", conn)
Dim adapter As New OleDbDataAdapter
Dim dt As New DataTable
adapter.SelectCommand = command
adapter.Fill(dt)
DataGridView1.DataSource = dt
adapter.Dispose()
command.Dispose()
conn.Close()
End Using
Label7.Visible = True
Label7.Text = " moyenne annuelle"
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub |
Partager