Start New Discussion within our Software Development Community

hello every1,
am unable to edit data in a data table and save it to the data base.
this is my code
this is to fill the data table

m_ContentsDataAdapter = New OleDb.OleDbDataAdapter("Select ConID,CID,ID,Combination_Name,Basic_Name,Code,Weight,Unit from contents", oledbcon)
        m_ContentsDataAdapter.Fill(m_ContentsDataTable)
        m_ContentsCommandbuilder = New OleDb.OleDbCommandBuilder(m_ContentsDataAdapter)

to edit the data this is the code

While ColourCount < m_ColourDataTable.Rows.Count
                If id = m_ColourDataTable.Rows(ColourCount)("ID") And editvalue = _
                m_ColourDataTable.Rows(ColourCount)("Combination_Name") Then
                    m_ColourDataTable.Rows(ColourCount)("Combination_Name") = txtColourName.Text.Trim
                    m_ColourDataTable.AcceptChanges()
                    Exit While
                End If
                ColourCount = ColourCount + 1
            End While

   m_ColourDataAdapter.Update(m_ColourDataTable)

no changes are being made to the database. plz help..
m using access 07 and vb.net 2005

By calling the AcceptChanges method on a Dataset and/or DataTable you are changing the rowstate of all the records to "Unchanged". Later when you call DataAdapter.Update method, it will do nothing because none of the records are marked as modified.

Here's a quote I made in another post a few days ago

' Explicitly calling a Dataset/DataTable's AcceptChanges method
' seems to be a very common mistake by many programmers.
' In truth this is rarely needed. Your DataAdapter will automatically
' adjust the row state changes after any action command has
' been executed.

This question has already been answered. Start a new discussion instead.