Failed Update data by using a TableAdapter in .NET Framework applications

qp 21 Reputation points
2024-01-10T16:34:04.7466667+00:00
In Visual studio 2022, I have created a VB forms connect with my table in SQL. I can add new record in table but not update. Here is the code

Private Sub ButtonUpdate_Click(sender As Object, e As EventArgs) Handles ButtonUpdate.Click 
     Try 
         Me.Validate() 
         Me.EmployeeBindingSource.EndEdit() 
         Me.EmployeeTableAdapter.Update(Me.HRDataSet.Employee) 
         MsgBox("Update successful") 
     Catch ex As Exception 
         MsgBox("Update failed") 
     End Try 
 End Sub
VB
VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,778 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.