I use the binding navigatorsaveitem to save my data back to the database, but the way I am doing it today seems to take an awful lot of time.
Ex:

Private sub .....SaveItem_Click(Etc Etc Etc)Handles ....Click

Me.Validate()
Me.Process1BindingSource.EndEdit()
Me.Process2BindingSource.EndEdit()
Me.Process3BindingSource.EndEdit()
Me.Process4BindingSource.EndEdit()
Me.Process5BindingSource.EndEdit()
Me.Process6BindingSource.EndEdit()
Me.Process7BindingSource.EndEdit()
Me.Process8BindingSource.EndEdit()
Me.Process9BindingSource.EndEdit()
Me.Process10BindingSource.EndEdit()
Me.Process11BindingSource.EndEdit()

Me.TableadapterManager.UpdateAll(Me.DataSet)

'Then I run a Methot who runs all my processes to calculate the new values.
Kjor()

'Ten I save all the new calculated values back to the database again.

Me.Validate()
Me.Process1BindingSource.EndEdit()
Me.Process2BindingSource.EndEdit()
Me.Process3BindingSource.EndEdit()
Me.Process4BindingSource.EndEdit()
Me.Process5BindingSource.EndEdit()
Me.Process6BindingSource.EndEdit()
Me.Process7BindingSource.EndEdit()
Me.Process8BindingSource.EndEdit()
Me.Process9BindingSource.EndEdit()
Me.Process10BindingSource.EndEdit()
Me.Process11BindingSource.EndEdit()

Me.TableadapterManager.UpdateAll(Me.DataSet)

Is there any "easier" or faster way to do this.?
I use datagridview to display the numbers and I do the changes in the datagridview.
Of cource I could have 1 buton on each tab to save each datagridview but I think that is not how I would like program to be if I was to use it.

ince No one have any idea on this one I will try another angle.

Is there a way to determine if the datagridview har been altered?

The dataset.haschanges will not work since it includes the whole dataset.
I need to be able to check if one of the tables has been changed and not the whole database.

-how about this?

I am trying to make a method where I can choose which prosesses to save,

Private Sub Save(ByVal prosess As String)
     
        For Each row As DataRow In Me.Kalkyle1DataSet.Tables("prosess")
            If row.RowState = DataRowState.Added Or DataRowState.Modified Or DataRowState.Deleted Then
                Me.Stalsoyler_totalTableAdapter.Update(stalstupdates)
            End If
        Next





    End Sub

But I get an error saying :


Error 1 Expression is of type 'System.Data.DataTable', which is not a collection

Can anyone help me out here?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.