Bonjoir le informaticiens !
Je travaille sur un projet VB pour la gestion d'absence, l'idee c'est d'avoir une datagridview qui contient la liste des etudiants devant chacun il y a un checkbox ou button si j'en clique les données de cet etudiant seront envoyés vers une table absence. Voici le code sur lequel je travaille :
Merci d'avance !
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39 Private Sub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick Dim chk As DataGridViewCheckBoxColumn = New DataGridViewCheckBoxColumn() chk.HeaderText = "absence" DataGridView1.Columns.Add(chk) For Each btn As Button In DataGridView1.Columns("absence") For i As Integer = 0 To DataGridView1.Rows.Count - 1 If btcln.Selected Then btcln.Visible = False End If Next For i As Integer = 0 To DataGridView1.Rows.Count - 1 If btcln.Visible = False Then Dim req2 As String req2 = "INSERT INTO tabl3 SELECT Id, Nom FROM tabl1 WHERE'" & DataGridView1.Rows(i).Selected = True & "'" cmd = New OleDbCommand(req2, conn) End If adap = New OleDbDataAdapter() adap.SelectCommand = cmd Next Next For i As Integer = 0 To DataGridView1.Rows.Count - 1 If CBool(DataGridView1.Rows(i).Cells("absence").Value) = True Then Dim req2 As String = "INSERT INTO tabl3 SELECT Id, Nom FROM tabl1 WHERE ' " & i & " ' " cmd = New OleDbCommand(req2, conn) End If Next adap.Fill(ds) End Sub End Class
Partager