Bonjour,

J'ai repris un programme écrit en VB.NET qui fonction en MVC(Model, Control,
View) donc j'ai 4 parties les 3 citées en haut et le programme normal.

Je dois faire une listBox qui doit afficher les heures de travail d'une machine. Ces heures je les récupère dans une BDD.
Mon soucis d'affichage c'est que je n'arrive pas a afficher l'heure correct dans ma listBox, elle m'affiche toujours 00:00:00 au lieu de 08:00:00 par exemple.

J'ai testé ma requete sur SQL Serveur, elle fonctionne bien j'ai bien toutes les heures qui s'affichent.

Si quelqu'un peut m'aider plz je n'arrive pas a trouver pourquoi mon heure change pas.

Voici mon code :

Le code du programme normal:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
        Dim idMachine As Integer
        viewChoixMacPoste.viewAffichPosteListBox(idMachine)
        Dim HFinPoste2 As Date
        Dim HDebPoste2 As Date
        Dim JProd As Date
        JProd = curOutputDay
        If Me.CB_NumMach.SelectedValue = 13 Then
 
            ListBox1.Items.Add(HDebPoste2 & "   " & HFinPoste2 & "   " & JProd)
 
        End If
Le code du prigramme View:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
controlChoixMacPoste.controlAffichPosteListBox(idMachine)
Le code du programme control:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
Public Function controlAffichPosteListBox(ByVal chiffre2 As Integer) As String
        Dim HFinposte2 As Date = Nothing
        HFinposte2 = modelChoixMacPoste.modelAffichPosteListBox(chiffre2)
        Return HFinposte2
    End Function
Le code du programme model:

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
    Public Function modelAffichPosteListBox(ByVal idMachine As Integer) As Date
        Dim HFinPoste2 As Date = Nothing
        Dim datetest As Date = "19/09/2008 05:00:00"
        Dim IDMACHIN As Integer = 13
 
Requete = "SELECT DISTINCT (EMO.HDEB_POSTE_EVENT_MACHINE_OEE) ,  EMO.HFIN_POSTE_EVENT_MACHINE_OEE, PO.NOM_LONG_POSTE_OEE, EMO.JPROD_EVENT_MACHINE_OEE 
FROM EVENT_MACHINE_OEE EMO, POSTE_OEE PO 
WHERE PO.ID_POSTE_OEE = EMO.ID_POSTE_OEE 
AND EMO.ID_MACHINE_OEE = " & IDMACHIN & " 
AND JPROD_EVENT_MACHINE_OEE = " & datetest & " 
ORDER BY EMO.HDEB_POSTE_EVENT_MACHINE_OEE DESC"
 
Try
            reader = connection.GetAReader(Requete)
            HFinPoste2 = reader("HFIN_POSTE_EVENT_MACHINE_OEE")
        Catch ex As Exception
        End Try
        reader.Close()
 
        connection.CloseConnection()
 
        Return HFinPoste2
 
    End Function