Database Save Problem


  • Hi all,

    I posted this in the SQL Server Express forum, but meant to post it here (assuming this is the proper location to ask this question).

    Anyway... I know this has been asked several times, but I cannot seem to find a resolution to my issue.  Basically my updates appear to be saving to the DataSet, but not back to the database.

    I may be in over my head (still learning SQL), but here is my situation...

    I have a SQL Server Express DB with numerous tables. I have the need to modify all of these tables through a single form. I found an MSDN article that said I could create a DataGridView using multiple DataSources.  So I created my project, created my DataSource/DataSet and dragged one of the DataSources to the form.

    I then dragged additional DataSources to the DataGridView (with instruction from the article).  I then added a combobox to the form to control which DataSource gets loaded to the DataGridView.  Here is a small snippet of what the combobox does on SelectedIndexChanged:

     Case Is = "Bolts"
                    dataGridView.DataSource = Nothing
                    dataGridView.DataSource = Me.ECDT_C_V_BOLTSBindingSource
                    BindingNavigator.BindingSource = Me.ECDT_C_V_BOLTSBindingSource

    Basically it assigns the DataSource and BindingNavigator.

    So far everything works great! The DataSource displayed in the DataGridView changes when selected with the combobox and the BindingNavigator controls cycle through the items as expected.

    Unfortunately, the only table that will save back to the database is the first one I dragged to the form to originally create the DataGridView.  All other changes appear to save to the DataSet, but not to the DataBase.

    I have added primary Keys to all of my tables and ensured the “Copy to Output Directory” option was unchecked.

    I noticed that the DeleteCommand and UpdatedCommand properties of all of the TableAdapaters were both set to (None), so I changed them to (DeleteCommand) and (UpdateCommand) respectively, but still no luck.

    No exceptions are thrown.

    I am out of ideas!  Can anyone give me some advice on getting these changes to save back to my database?

    Thanks in advace!


    Monday, June 24, 2013 2:28 PM


  • I think I may have figured this out...

    Apparently dragging multiple DataSource tables into the DataGridView does not fill in the properties of the TableAdatapterManager automatically.  I had to go into the properties and assign a value to each TableAdapter listed in the properties of the TableAdatapterManager .

    Additionally, each TableAdapter was missing the CommandText value of the UpdateCommand so no command was being executed on save.

    Hopefully this will help someone else out if they run into a similar problem.



    • Marked as answer by Rob Outman Monday, June 24, 2013 4:47 PM
    Monday, June 24, 2013 4:47 PM