none
Dataset changes not being updated in database RRS feed

  • Question

  • Hi guys,

     

    I'm experienced in VBA, but new to .NET. I have a simple application that I'm building to learn .NET using VB Express 2008.

    My issue is getting my local sql express database to update from my dataset. I'll try to explain as simply as possible:

    1. I have a form in which the user can ADD a buyer, which I want stored in my buyers table. When the form loads, I have the following code:

    Me.TblBuyersTableAdapter.Fill(Me.DBDataSet.tblBuyers)

    2. From here, I can see all the existing data (output to a combobox), populated from the dataset. The user will now type in all the details of the new buyer, then click save. This will execute the following code:

    Me.DBDataSet.tblBuyers.AddtblBuyersRow(tbFirstName.Text, tbSurname.Text, tbMobile.Text, tbOtherPhone.Text, tbEmail.Text, cbPreference1.Text, cbPreference2.Text, cbColour.Text)

    Me.TblBuyersTableAdapter.Update(Me.DBDataSet.tblBuyers)

    3. This seems to correctly store the new data in the dataset (because I can now see it in my combobox if I rerun the populate combobox code)....however, it doesn't get saved in the database.....I've also tried: 

    Dim changedRecords As DataSet

    changedRecords = DBDataSet.GetChanges()

    Which correctly shows the new record once I've added it, so I think my problem lies within the .Update call.

    I've also tried:

    Me.TableAdapterManager.UpdateAll(Me.USACarsDBDataSet), but this didn't work either.

    Any help would be greatly apprieciated because this supposedly so simple task is driving me crazy!!

    Thanks in advance.

    Monday, February 15, 2010 8:22 PM

Answers

All replies