I guess I've been away from this stuff for too long.
Could someone please point me in the right direction?
I'm trying to update the data in the NotesHistory table of the Northwind database.
I'm displaying the data in a datagrid, and I'm displaying the "Type" field in a combobox within the datagrid.
I have a save button outside the datagrid.
After editing the "Type" field (changing it from "Notes" to "Call"), I want to be able to click the "save" button, and update the NotesHistory table to reflect the change.
The data adapter is named OleDbDataAdapter2
The dataset is named dsNotesHistory1
What should my OleDbDataAdapter2 Update Command Text be set to?
My code for the save button is currently as follows:
Private Sub btnSaveNotesHistory_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles btnSaveNotesHistory.Click
Dim UpdateResult As Integer = -1
Try
intNotesHistory_CurrentRecord = Me.BindingContext(DsNotesHistory1.Tables(0)).Count - 1
DsNotesHistory1.Tables(0).Rows(intNotesHistory_CurrentRecord).Item("Contact_ID") = intContacts_Unique_ID
UpdateResult = OleDbDataAdapter2.Update(DsNotesHistory1)
DsNotesHistory1.AcceptChanges()
OleDbDataAdapter2.Fill(DsNotesHistory1)
Catch ex As System.Exception
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
Finally
End Try
ShowRecord(intContacts_CurrentRecord, intContacts_Unique_ID)
End Sub
When I get to the line
UpdateResult = OleDbDataAdapter2.Update(DsNotesHistory1)It throws an exception
What am I doing wrong?
Along with trying to explain what I'm doing wrong, could someone post the code that would accomplish what I am trying to do?....I learn much better from example than I do from just words.
TIA,
Rick
----------------------------------