Bonjour

tout est dans le titre.
Je tente de mettre a jour des champs d'un dataset et de repercuter les changements dans la BD mais ca ne marche pas.
Je vois le rowState passé a Modified

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
		private void update_row()
		{
			// je recupere la clé de la table selectionnée
			sqlConnection1.Open();
			string req = "SELECT id_fichier FROM FICHIERS WHERE tableCorrespondante = '" + nomTable + "'";
			SqlCommand requete = new System.Data.SqlClient.SqlCommand(req, sqlConnection1);
			idFichier = (int)requete.ExecuteScalar(); 
			sqlConnection1.Close();
 
			try
			{
				sqlDataAdapterFichiers.Fill(dataSetFichiers1);
 
				// on met à jour la bonne ligne grace a la clé
				// dataSetFichiers1.FICHIERS.LoadDataRow();
 
				DataSetFichiers.FICHIERSRow myRow = dataSetFichiers1.FICHIERS.FindByid_fichier(idFichier) ;
				myRow.nom_fichier = System.IO.Path.GetFileName(txt_filePath.Text);
				myRow.typeOrigineInfo = "" ;
				myRow.chemin_absolu = txt_filePath.Text ;
				myRow.type_generation = cbx_typeGene.Text ;
                            dataSetFichiers1.AcceptChanges();
 
				save();
			}
			catch (Exception ex)
			{
				MessageBox.Show("Erreur dans la copie du nom");
				MessageBox.Show(ex.Message);
				return;
			}
		}
 
		public void save()
		{
			try
			{
				// on met à jour la BD à partir du dataset
				sqlDataAdapterFichiers.Update(dataSetFichiers1);
				MessageBox.Show("Record successfully modified");	
			}
			catch(Exception ex)
			{
				MessageBox.Show("Error updating record\n" + ex.Message);
				dataSetFichiers1.RejectChanges();
				return ;
			}
		}
J'execute pourtant AcceptChanges() puis Update() alors je ne comprends vraiment pas.

Est-ce que je fais les choses dans le désordre ?
Ou est-ce qu'il me manque quelquechose dans mon code ?

merci pour votre aide