Having Trouble Updating Values [Resolved]
Creating a simple db application. 4 textboxes, and this is the code I am using in the click event of the update button:
VB Code:
'dsDataSet is my dataset, already declared.
Dim dr As DataRow
'Set the primary key for the table
With dsDataSet.Tables("Customers")
dsDataSet.Tables("Customers").PrimaryKey = New DataColumn() {.Columns("CustomerID")}
End With
Dim pkey As Object
pkey = TextBox1.Text
dr = dsDataSet.Tables("Customers").Rows.Find(pkey)
dr.BeginEdit() 'Start editing process
'Enter new field values in the row
dr.Item(0) = TextBox1.Text
dr.Item(1) = TextBox2.Text
dr.Item(2) = TextBox3.Text
dr.Item(3) = TextBox4.Text
dr.EndEdit() 'End editing process
dsDataSet.AcceptChanges() 'Submit changes to dataset
MessageBox.Show("Successfully Updated")
It seems that the dataset is being updated, but the values are not being changed in the database. What am I missing?