Hi guys, I have got a button to update and save data changes.

When I did not make any changes, I will have a successful update.

When I made changes, it will be give me this error:(Without Try statements)

Update requires a valid UpdateCommand when passed DataRow collection with modified rows.

The below is my codings. Anyone have suggestions? Thanks.:eek:

If Me.Validate Then
            Try
                Me.CanDrinksBindingSource.EndEdit()
                Me.CanDrinksTableAdapter.Update(Me.StockDataSet.CanDrinks) 'Update method
                MessageBox.Show("Update Successful!")

            Catch ex As Exception
                MessageBox.Show("Update failed")
            End Try
        End If

What did you set the UpdateCommand property as?

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.