Hello All,
I am having problems using the Update method of a DataAdapter. Can anyone tell me why the below code does not work?
When placed in the click event of a button the code appears to execute without error but no changes occur to the underlying database. However, if I execute the code by calling the 'executenonquery' method of the command object I am able to update the underlying database. I know there must be something that I am missing. Any ideas?
Cheers,
sfx
I am having problems using the Update method of a DataAdapter. Can anyone tell me why the below code does not work?
VB.NET:
cmdUpdateCustomers = New OleDbCommand
cmdUpdateCustomers.Connection = conCustomers
cmdUpdateCustomers.CommandText = "UPDATE tblCustomers SET FName = @FName WHERE CustomerID = @CustomerID;"
cmdUpdateCustomers.Parameters.Add("@FName", OleDbType.VarChar, 50).Value = txtFName.Text
cmdUpdateCustomers.Parameters.Add("@CustomerID", OleDbType.Integer, 16).Value = txtCustomerID.Text
daCustomers.UpdateCommand = cmdUpdateCustomers
daCustomers.Update(dsCustomers, "tblCustomers")
When placed in the click event of a button the code appears to execute without error but no changes occur to the underlying database. However, if I execute the code by calling the 'executenonquery' method of the command object I am able to update the underlying database. I know there must be something that I am missing. Any ideas?
Cheers,
sfx