Saves added records, but won't save new record information

matt09524

Well-known member
Joined
Sep 14, 2005
Messages
47
Because I am still kinda learning, I used a guide to help me make this program and I modified it to my personal needs. Everything that I have coded works except that when the user hits the edit button, they can edit the fields, and it appears to save when they click save, but it wont save the new information. Also, when I hit the "create new" button, it uses the data from the original entry that I put in. this is the save button code:

Code:
Private Sub Save()

        [Update]
        Try
            Me.BindingContext(DataSet11, _
              "information").EndCurrentEdit()
            odaContacts.Update(DataSet11, _
              "information")
        Catch eSave As System.Exception
            MessageBox.Show(eSave.Message)
        End Try
        [See custom procedures]
        Me.DataSet11_PositionChanged()
        [See custom procedures]
        ReadOnlyOn()
    End Sub

this is how I call the sub when the button is pressed.

Code:
Private Sub contacttoolbar_ButtonClick(ByVal sender As _
        System.Object, ByVal e As _
        System.Windows.Forms.ToolBarButtonClickEventArgs) _
        Handles contacttoolbar.ButtonClick

        [Use tag property to select button]
        Select Case e.Button.Tag
            Case "Add" This is the tag property
                Add() This is the previously written Sub
            Case "Edit"
                Edit()
            Case "Save"
                Save()
                SetNavButtons(sender, e)
            Case "Clear"
                Cancel()
                SetNavButtons(sender, e)
            Case "Email"
                SendMail()
            Case "Delete"
                Delete()
            Case "First"
                NavFirst()
            Case "Previous"
                Previous()
            Case "Next"
                NavNext()
            Case "Last"
                NavLast()
            Case "About"
                About.Show()
            Case "Help"
                Help.Show()
            Case "Exit"
                Shutdown()
                [Use tag property to select button/]

        End Select

    End Sub

Any ideas? I know the connection to the db is good because it is saving the fact that I added or deleted records, but it just wont save the information. Also.. on a side note, VB says the CASE statements may cause runtime time errors but allows me to build it regardless.
 
What do you mean it doesnt save? You say its saving to the database...thats a pretty clear case that it did save?... You mean the datagrid isnt updating? You should always rebind after altering information.
 
bri189a said:
What do you mean it doesnt save? You say its saving to the database...thats a pretty clear case that it did save?... You mean the datagrid isnt updating? You should always rebind after altering information.

Yes, it does save. It updates only the new amount of records, weather deleted or added, but not any new information. rebind? how would I go about that? :D Im still learning all this stuff :)
 
... :eek: ya prolly :-\

/edit - INSERT does not appear to be valid. Update seems to be working fine because it is saving the NUMBER of records, just not the actual information in them.
 
Last edited by a moderator:
matt09524 said:
... :eek: ya prolly :-\

/edit - INSERT does not appear to be valid. Update seems to be working fine because it is saving the NUMBER of records, just not the actual information in them.


Well.. in my effort at trying to learn this way, I have met failure. The template I used has the same problem. The record counter that indicates "Record x of y" updates, but I dont think the actual information is updating. Could this be a misconfigured data connection?
 
Back
Top