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
| Dim ObjetConnection As SqlConnection
Dim ObjetCommand As SqlCommand
Dim ObjetDataAdapter As SqlDataAdapter
Dim ObjetDataSet As New DataSet
Dim strSql As String
Dim strConn As String
Dim cb As SqlCommandBuilder
Dim DV1 As DataView
Dim dt As New DataTable
Dim rw As Integer
Dim s As String
strConn = "data source=localhost;" & "integrated security=SSPI;" & "initial catalog=Projet"
strSql = "SELECT Salarie.* from Salarie"
ObjetConnection = New SqlConnection()
ObjetConnection.ConnectionString = strConn
ObjetConnection.Open()
ObjetCommand = New SqlCommand(strSql)
ObjetCommand.Connection = ObjetConnection
ObjetDataAdapter = New SqlDataAdapter(ObjetCommand)
ObjetDataAdapter.Fill(ObjetDataSet, "Salarie")
dt = ObjetDataSet.Tables("Salarie")
cb = New SqlCommandBuilder(ObjetDataAdapter)
DV1 = New DataView(ObjetDataSet.Tables("Salarie"))
DV1.RowFilter = "Fonctionsalarie <> 'Vendeur'"
ComboBox1.DataSource = DV1
ComboBox1.DisplayMember = "Numerosalarie"
s = ComboBox1.Items(0).ToString
If s = dt.Rows(rw).Item("Numerosalarie").ToString Then
Me.Label4.Text = dt.Rows(rw).Item("Nomsalarie").ToString
Me.Label5.Text = dt.Rows(rw).Item("Prenomsalarie").ToString
Me.Label6.Text = dt.Rows(rw).Item("Fonctionsalarie").ToString
End If |
Partager