Bonjour,

Je ne trouve pas pourquoi cela ne fonctionne pas, et je ne vois pas pourquoi!
j'ai suivi la methode de http://plasserre.developpez.com/vsommair.htm

alors j'ai une class qui gere la table "rhEmployes" qui ressemble a ça :
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
 
   Public Class rhEmployes
        Private _strConn As String
        Private _strSql As String
        Private _adapter As OleDbDataAdapter
        Private _ObjDataSet As New Data.DataSet
        Private _ObjetCommandBuilder As OleDbCommandBuilder
 
        Public Sub New()
            _strConn = My.Settings.dataConnectionString
            _strSql = My.Settings.SQLEmployes
 
            _adapter = New OleDbDataAdapter(_strSql, _strConn)
            _ObjDataSet = New Data.DataSet
            _adapter.Fill(_ObjDataSet)
 
        End Sub
 
        Public Function update_row(ByVal matricule As String, ByVal nom As String, ByVal prenom As String, ByVal service As String, ByVal equipe As String, ByVal particularite As String, ByVal embauche As Date, ByVal interim As Boolean, ByVal actif As Boolean, ByVal manager As Boolean, ByVal empLog As String) As Boolean
            Dim expression As String = "empMatricule='" & matricule & "'"   'expression à rechercher
            Dim foundRow() As DataRow
            Dim ObjetDataTable As New DataTable
            'résultat dans des DataRow
            'ObjetCommandBuilder = New OleDbCommandBuilder(ObjetDataAdapter)
            Try
                ObjetDataTable = _ObjDataSet.Tables(0)
                foundRow = ObjetDataTable.Select(expression)
                foundRow(0).BeginEdit()
                foundRow(0)("empNom") = nom
                foundRow(0)("empPrenom") = prenom
                foundRow(0)("empService") = service
                foundRow(0)("empEquipe") = equipe
                foundRow(0)("empParticularite") = particularite
                foundRow(0)("empActif") = actif
                foundRow(0)("empDateDebut") = embauche
                foundRow(0)("empLogin") = empLog
                foundRow(0)("empManager") = manager
                foundRow(0)("empinterim") = interim
                foundRow(0).EndEdit()
                _ObjetCommandBuilder = New OleDbCommandBuilder(_adapter)
 
                _adapter.Update(foundRow)
                MessageBox.Show(foundRow(0).RowState)
                Return True
            Catch ex As Exception
                MessageBox.Show(ex.Message)
                Return False
            End Try
        End Function
 
        Public ReadOnly Property datatable() As DataTable
            Get
                Return (_ObjDataSet.Tables(0))
            End Get
        End Property
    End Class
et une form je fais :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
 
Private Emp As New rhEmployes
....
....
....
....
 
 If Emp.update_row(Me.TextBoxMatricule.Text, Me.TextBoxNom.Text, Me.TextBoxPrenom.Text, Me.ComboBoxService.SelectedValue, Me.ComboBoxEquipe.SelectedValue, Me.ComboBoxParticularite.SelectedValue, Me.DateEmbauche.Value, Me.CheckBoxInterim.Checked, Me.CheckBoxActif.Checked, Me.CheckBoxManager.Checked, Me.TextBoxLogin.Text) Then
les valeurs sont correctes dans chaques champs.
le foundRow(0).RowState = 2 --> unchanged
Aucune exception levée !
le FoundRow enregistre bien les mise à jour.

Mais voila, aucune modification n'est faite dans la base de données ????
Pouviez-vous aider un novice ?

Merci d'avance