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
| Private Sub initialiserListe()
Dim strsql As String
'connection a la base de donnée cousintransport
cnnbase.ConnectionString = "Persist Security Info=False;Integrated Security=SSPI;database=cousintransport;server=PC-DE-KAABI\SQLEXPRESS"
cnnbase.Open()
strsql = "select * from client"
Dim myCommand As New SqlCommand(strsql, cnnbase)
Dim myReader As SqlDataReader = myCommand.ExecuteReader()
myReader.Read()
While myReader.Read
With Me.lvwclients.Items.Add(myReader.GetInt64(0).ToString)
.SubItems.Add(myReader.GetString(1).ToString)
.SubItems.Add(myReader.GetString(2).ToString)
End With
End While
myReader.Close()
cnnbase.Close()
End Sub |