Bonjour,

Je vais essayer d'être claire et simple.

J'ai une classe qui correspond à deux tables avec un lien maître / détail.
Table maître : Lot
Table détail : LOTPropertyDate

J'ai une classe (Lot.vb) qui contient donc :
* Les propriétés du lot
* Des objets de table pour faire le lien maître / détail :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
 
    Private LotPropertyDateView As DataView
    Private LotPropertyDateTable As DataTable
    Private LotPropertyDateSQLDA As SqlClient.SqlDataAdapter
J'ai également une propriété DataView pour récupérer les données depuis ma table Lot.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
 
    Public ReadOnly Property LotPropertyDate As DataView
        Get
            Return LotPropertyDateView
        End Get
    End Property

J'ai un ControlUser qui contient un DataGridView (LotInfosDate.vb).
Au chargement de la form qui contient le ControlUser, j'affecte le DataSource avec le code suivant :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
 
        DGVInfosDate.DataSource = LotLocal.LotPropertyDate
        DGVInfosDate.Refresh()

Le chargement se fait correctement et les données sont renvoyées.

A la mise à jour, je clique sur un bouton "Save" qui fait appel à
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
 
LotLocal.LotPropertyDateMAJ()
qui contient le code suivant :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
 
        LotPropertyDateSQLDA.UpdateCommand = LotPropertyDateManager("update")
        LotPropertyDateSQLDA.Update(LotPropertyDateTable)
Voici le code de LotPropertyDateManager :
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
59
60
61
62
63
64
65
66
67
68
69
 
    Private Function LotPropertyDateManager(ByVal CmdType As String) As SqlCommand
        'Dim CommandName As String = "LotPropertyDate" + CmdType
        Dim SQLCMD As New SqlClient.SqlCommand("PTLots.LotPropertyDate" + CmdType, DB.Connection)
 
        SQLCMD.CommandType = CommandType.StoredProcedure
 
        Dim IDPropertyDate As New SqlClient.SqlParameter("@IDPropertyDate", SqlDbType.Int, 10)
        Dim GUIDPropertyDate As New SqlClient.SqlParameter("@GUIDPropertyDate", SqlDbType.UniqueIdentifier, 0)
        Dim IDLot As New SqlClient.SqlParameter("@IDLot", SqlDbType.Int, 10)
        Dim PropertyTypeDate As New SqlClient.SqlParameter("@PropertyTypeDate", SqlDbType.NVarChar, 50)
        Dim PropertyValueDate As New SqlClient.SqlParameter("@PropertyValueDate", SqlDbType.DateTime2, 0)
        Dim ATUser As New SqlClient.SqlParameter("@ATUser", SqlDbType.NVarChar, 50)
        Dim ATHostName As New SqlClient.SqlParameter("@ATHostName", SqlDbType.NVarChar, 128)
        Dim ATAppName As New SqlClient.SqlParameter("@ATAppName", SqlDbType.NVarChar, 128)
        Dim ATMessage As New SqlClient.SqlParameter("@ATMessage", SqlDbType.NVarChar, 50)
 
 
        ' Equivalent de CmdType In (""select", "insert")
        If New String() {"select", "insert"}.Contains(CmdType) Then
            IDLot.Direction = ParameterDirection.Input
            IDLot.Value = _IdLot
            SQLCMD.Parameters.Add(IDLot)
        End If
 
        If New String() {"delete"}.Contains(CmdType) Then
            IDLot.Direction = ParameterDirection.Input
            IDLot.SourceVersion = DataRowVersion.Current
            IDLot.SourceColumn = "IDLot"
            SQLCMD.Parameters.Add(IDLot)
        End If
 
        If CmdType = "update" Then
            IDPropertyDate.Direction = ParameterDirection.Input
            IDPropertyDate.SourceVersion = DataRowVersion.Current
            IDPropertyDate.SourceColumn = "IDPropertyDate"
            SQLCMD.Parameters.Add(IDPropertyDate)
        End If
 
        If New String() {"insert", "update"}.Contains(CmdType) Then
            PropertyTypeDate.Direction = ParameterDirection.Input
            PropertyTypeDate.SourceVersion = DataRowVersion.Current
            PropertyTypeDate.SourceColumn = "PropertyTypeDate"
 
            PropertyValueDate.Direction = ParameterDirection.Input
            PropertyValueDate.SourceVersion = DataRowVersion.Current
            PropertyValueDate.SourceColumn = "PropertyValueDate"
 
            ATUser.Direction = ParameterDirection.Input
            ATHostName.Direction = ParameterDirection.Input
            ATAppName.Direction = ParameterDirection.Input
            ATMessage.Direction = ParameterDirection.Input
 
            ATUser.Value = _ATUser
            ATHostName.Value = _ATHostName
            ATAppName.Value = _ATAppName
            ATMessage.Value = _ATMessage
 
            SQLCMD.Parameters.Add(PropertyTypeDate)
            SQLCMD.Parameters.Add(PropertyValueDate)
            SQLCMD.Parameters.Add(ATUser)
            SQLCMD.Parameters.Add(ATHostName)
            SQLCMD.Parameters.Add(ATAppName)
            SQLCMD.Parameters.Add(ATMessage)
        End If
 
        LotPropertyDateManager = SQLCMD
 
    End Function
C'est dans cette dernière fonction que je ne récupère pas correctement mes paramètres.
Ils restent désespérément vides.

Quelqu'un aurait une idée ?

Merci infiniment d'avance pour vos réponses.