Problem with DatraGridView with saving multiple tables

VB2005 Geru,

Is their a problem in saving data to a database with multiple tables using multiple DataGridViews I am receiving the following error message:

Invalid Operation Exception was unhandled

Update requires a valid update command when passed Data Row Collection with modified rows.

When the app is built the first table that is dragged to the form will allow editing and saving. The second table produces the error. The error flaggs the second table when the tables are added in reverse order.

What am I missing This is the code I am using:

Public Class Form1

Private Sub MyErayBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyErayBindingNavigatorSaveItem.Click

Me.Validate()

Me.MyArayBindingSource.EndEdit()

Me.MyBrayBindingSource.EndEdit()

Me.MyArayTableAdapter.Update(Me.EADataSet.MyAray)

Me.MyBrayTableAdapter.Update(Me.EADataSet.MyBray)

End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Me.MyArayTableAdapter.Fill(Me.EADataSet.MyAray)

Me.MyBrayTableAdapter.Fill(Me.EADataSet.MyBray)

End Sub

End Class



Answer this question

Problem with DatraGridView with saving multiple tables

  • kbradl1

    VB2005 Gerus,

    OK, I have reviewed five new and comprehensive VB2005 textbooks (which only addressed one table in a database!), talked with several developers, and walked through MSDN’s “Saving Data to a database (Multiple Tables)” all to no avail. In my previous post, I tried to explain that I just want to use/edit tables in multiple datagridviews (one table for each grid) on a form. How did you avoid or work around the “Update requires a valid update command when passed Data Row Collection with modified rows” error when attempting to save changes in tables other than the first one dragged to the form Surely, this error is too obvious to be a VB 2005 bug. Thanks.

    Texas Charlie


  • Problem with DatraGridView with saving multiple tables