Results 1 to 3 of 3

Thread: [RESOLVED] Saving to DB using bound DataGridView in VB.Net

Hybrid View

  1. #1

    Thread Starter
    Super Moderator FunkyDexter's Avatar
    Join Date
    Apr 2005
    Location
    An obscure body in the SK system. The inhabitants call it Earth
    Posts
    7,957

    Resolved [RESOLVED] Saving to DB using bound DataGridView in VB.Net

    Just started teaching myself .net this weekend and I'm probably missing something fairly obvious

    I've create a simple test database and a dataset in the project. Created a simple fom and dragged a table onto it to auto-create a datagridview. All looks good and it displays the test data I populated into the DB fine.

    But if I make any changes and click Save they're not getting saved. I re-run the program and they've dissapeared. The code behind the save button is here:-
    Code:
    Private Sub AccountBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AccountBindingNavigatorSaveItem.Click
            If Me.Validate() Then
                Me.AccountBindingSource.EndEdit()
                Me.AccountTableAdapter.Update(Me.BloodNGutzDataSet.Account)
            Else
                MsgBox("Validation Failed", MsgBoxStyle.OkOnly & MsgBoxStyle.Exclamation)
            End If
        End Sub
    I can break into the code and it does run through this routine, it passes the validation and runs the EndEdit and Update statements. It's just that nothing seems to actually change in the DB. Any ideas what I'm doing wrong?
    The best argument against democracy is a five minute conversation with the average voter - Winston Churchill

    Hadoop actually sounds more like the way they greet each other in Yorkshire - Inferrd

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Saving to DB using bound DataGridView in VB.Net

    I'm not an expert with .Net, but I think the problem (and solution) might be as described in this post

  3. #3

    Thread Starter
    Super Moderator FunkyDexter's Avatar
    Join Date
    Apr 2005
    Location
    An obscure body in the SK system. The inhabitants call it Earth
    Posts
    7,957

    Re: Saving to DB using bound DataGridView in VB.Net

    Spot on and may I just say:-
    THATS A @/**$& STUPID SETTING

    The best argument against democracy is a five minute conversation with the average voter - Winston Churchill

    Hadoop actually sounds more like the way they greet each other in Yorkshire - Inferrd

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width