Bonjour à tous, je débute en dotnet, j'essaye de récupérer toutes les lignes d'une table en utilisant OleDb. Le problème est que je ne récupère que la dernière ligne
Voici mon code :
Merci de votre aide
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58 Using connection As New OleDbConnection(connectionString) Dim command As New OleDbCommand(queryString, connection) Dim colonne As Integer = 0 Dim ligne As Integer = 0 Dim operation As String Dim date_debut As Date Dim date_fin As Date Dim idER As String Dim tb As New TextBox Dim tblRowBody As New TableRow() Dim tblCellDateFin As New TableCell() Dim tblCellOperation As New TableCell() 'Dim tblCellOperation As New TableCell() Dim etatCube As String = "" connection.Open() Dim reader As OleDbDataReader = command.ExecuteReader() While reader.Read() If (reader.HasRows) Then idER = reader.GetString(0) operation = reader.GetString(1) date_debut = reader.GetDateTime(2) date_fin = reader.GetDateTime(3) tblCellOperation.Width = "100" tblCellOperation.BackColor = Drawing.Color.Beige tblCellOperation.Text = operation tblCellOperation.HorizontalAlign = HorizontalAlign.Center tblRowBody.Cells.Add(tblCellOperation) MonTableau.Rows.Add(tblRowBody) If (date_debut > date_fin) Then etatCube = "Calcul en cours" Else etatCube = "Calcul terminé" End If tblCellDateFin.Width = "100" tblCellDateFin.BackColor = Drawing.Color.Beige tblCellDateFin.Text = etatCube tblCellDateFin.HorizontalAlign = HorizontalAlign.Center tblRowBody.Cells.Add(tblCellDateFin) MonTableau.Rows.Add(tblRowBody) Else etatCube = "Connexion impossible" reader.Close() End If End While reader.Close() End Using
Partager