Hi All.

I am relatively new to programming so this may seem like a trivial question, but here goes. On my form I have a datagridview which is bound to a 'Supplier' table in Access 2003. Once I click on a record on the DataGridView, textboxes below which are also bound to the same source are automatically populated with the relevant data. What I want is when I click update, that the records in the database are updated as well as the dataset but what happens is that the dataset is updated, I invoke the tableadapater.update method but no permanent changes are made to the database.

Below is the code attached to the 'Edit Supplier' command button. Its pretty basic but any help would be greatly appreciated

Private Sub cmdEditSupplier_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdEditSupplier.Click

        Me.SupplierTableAdapter.Update(QuoteDataSet.Supplier)
        Me.SupplierTableAdapter.Fill(QuoteDataSet.Supplier)

    End Sub

Cheers

Perhaps its a silly question, but have you tried using a try/catch to see if its throwing an error of some type?

Secondly have you confirmed by opening the db itself that its not updating? I know in times past if I called info from a db I just wrote to I would get old data, since the computer was still writing to it. (If you have writecaching enabled)

Perhaps its a silly question, but have you tried using a try/catch to see if its throwing an error of some type?

Secondly have you confirmed by opening the db itself that its not updating? I know in times past if I called info from a db I just wrote to I would get old data, since the computer was still writing to it. (If you have writecaching enabled)

Hi there,

Yes, I had previously used a try/catch and it wasnt throwing up any exceptions and the db was the first thing I checked.

As it happens, I managed to find a little code snippet that worked perfectly. For interests sake, this is what I ended up using

Private Sub cmdEditSupplier_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdEditSupplier.Click

        Try
            Me.Validate()
            Me.SupplierBindingSource.EndEdit()
            Me.SupplierTableAdapter.Update(Me.QuoteDataSet.Supplier)
            MsgBox("Update successful")

        Catch ex As Exception
            MsgBox("Update failed")
        End Try

    End Sub

Thanks anyway for the reply.
Take care

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.