Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Question about Updating from a data grid
Message
 
To
09/02/2004 14:36:46
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00875522
Message ID:
00875592
Views:
20
Thank you Bonnie.
I'll go read up on the CommandBuilder.
Rick

>Rick,
>
>My guess is that you're trying to use the DataAdapter Update() method, but you haven't used the CommandBuilder to build the various commands. If that's the case, you need to read up on using the CommandBuilder ... I can't give you any pointers really because I don't Update this way, but seeing as how no one has replied to your post yet, I thought I would at least help you get going in the right direction (at least as far as using the .Update() method anyway)...
>
>
>~~Bonnie
>
>
>>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
>>    'Save the information currently displayed on the Notes/History Tab
>>    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
>>----------------------------------
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform