J'ai défini l'événement MouseClick sur un datagridview. Je veux si je click sur l'enregistrement les données du datagriview remontent dans les champs de saisie pour que je puisse les modifier.
Pour chaque enregistrement je dispose de deux photos.
Par clic, toutes les autres données remontent dans leurs champs de saisi sauf la deuxième photo. Il vient un message que le champ de cette 2ème photo n'appartient pas à la Vue(table) que j'ai créée.

Comment faire pour que cette deuxième photo aille dans sa zone saisie? Au secours!!
Voici le code source utilisé:

Code C# : 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
 
private void dgvDependant_MouseClick(object sender, MouseEventArgs e)
       {
           DataGridViewRow dr = dgvDependant.SelectedRows[0];
           try
           {         
 
           SqlCommand cmd = new SqlCommand("SELECT PhotoAbonne FROM VueDependant WHERE IdDependant='" + textIdDependant.Text.Trim() + "'", oConn);
           SqlDataAdapter da = new SqlDataAdapter(cmd);
           DataSet ds = new DataSet();
           da.Fill(ds, "VueDependant");
           int c = ds.Tables["VueDependant"].Rows.Count;
 
                   Byte[] bytePhoto = new Byte[0];
 
                   if (c > 0 )
                    {                                          
                      bytePhoto = (Byte[])(ds.Tables["VueDependant"].Rows[c - 1]["PhotoAbonne"]);
                      MemoryStream stmPhoto = new MemoryStream(bytePhoto);
                      pictAbonne.Image = Image.FromStream(stmPhoto);
                    }
 
                   SqlCommand cmd2 = new SqlCommand("SELECT PhotoConjoint FROM VueDependant WHERE         IdDependant='" + textIdDependant.Text.Trim() + "'", oConn);
             SqlDataAdapter da2 = new SqlDataAdapter(cmd);
             DataSet ds2 = new DataSet();
             da2.Fill(ds2, "VueDependant");
             int d = ds2.Tables["VueDependant"].Rows.Count;
             if (d > 0)
                   {
                       bytePhoto = (Byte[])(ds.Tables["VueDependant"].Rows[c - 1]["PhotoConjoint"]);
                       MemoryStream stmPhoto = new MemoryStream(bytePhoto);
                       pictConjoint.Image = Image.FromStream(stmPhoto);
                   }                     
            }
 
           catch (Exception ex)
           {
               MessageBox.Show(ex.Message);
           }                            
 
       }