Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27404

Saving datagridview entries in the database works only after restart

$
0
0
Hello,

I have a database and I want to edit it's records through a DataGridView. I have done this and it works fine. The problem is that I can't see the new values until I restart my application. This is the code I am using for updating the database:

Code:

  Dim test1 = (From a In DATABASE Where a.Name = "component" Select a).First 'This is just to test before and after values
            MsgBox("Before: " & test1.Price)
            Me.Validate()
            Me.ComponentsBindingSource.EndEdit()
            Me.ComponentsTableAdapter.Update(Me.ContactsDataSet.Components)

            Me.ContactsDataSet.AcceptChanges()

            Dim test2 = (From a In DATABASE Where a.Name = "component" Select a).First
            MsgBox("After: " & test2.Pret)

So, my problem is that I get the same value for test2 as test1. But after I restart my app the values I entered in the DGV are the correct ones.

What am I missing in order to update correctly my database and see it's new values without restarting?

Thx.

Viewing all articles
Browse latest Browse all 27404

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>