Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

Saving Bound Changes

$
0
0

I am using Visual Basic 2010 with an SQL Server 2005 database. My form contains a DataGridView and a number f bound controls.

If I add a new record it saves the data to the correct table perfectly.

If, however, I want to make a change to an existing record, I change the entry in the bound control (or entries in the bound controls) and the click the "BindingNavigatorSaveItem"  get get the "succeeded" text message and the DataGridView is changed but the table in the SQL Server is unchanged.

The code is below:

   Private Sub TblBooksBindingNavigatorSaveItem_Click(sender As System.Object, e As System.EventArgs) Handles TblBooksBindingNavigatorSaveItem.Click
        Try
            Me.Validate()
            Me.TblBooksBindingSource.EndEdit()
            Me.TblBooksTableAdapter.Update(Me.MyCollectionsDataSet.tblBooks)
            lblResults.Text = "Changes to the database have succeeded."
        Catch x As Exception
            lblResults.Text = "There was an error in the update process. Please check your entries and try again."
        End Tr

I have checked all of the Data Bindings properties and all appear to me to be correct, and in fact work fine for new record insertions.  I'm at a loss.

Milt


sirmilt


Viewing all articles
Browse latest Browse all 2535

Trending Articles



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