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 dreader As SqlDataReader = getmatrix()
Dim min As Decimal = 0
For i = 0 To DataGridView1.RowCount - 1
While (dreader.Read())
If (DataGridView1.Rows(i).Cells("Workplace").Value = dreader(0)) Then
If (DataGridView1.Rows(i).Cells("E2").Value >= dreader(5)) Then
min = dreader(5)
MsgBox(min)
End If
DataGridView1.Rows(i).Cells("level").Value = min
End If
End While
Next
Private Function getmatrix()
conn = New SqlConnection()
conn = connexion()
Dim sql As String = ("select workplace,workplacegroup,cost_center,area,niveau,valeur,month from matrice")
Dim exec As SqlCommand = New SqlCommand(sql, conn)
Dim dreader As SqlDataReader = exec.ExecuteReader
Return dreader
conn.Close()
End Function |
Partager